日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

CentOs6.5下独立安装Nginx篇

發(fā)布時(shí)間:2025/7/14 73 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CentOs6.5下独立安装Nginx篇 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

一、檢查系統(tǒng)是否安裝了Nginx

[root@localhost local]# find -name nginx [root@localhost local]#

(如果已經(jīng)安裝了nginx就卸載掉原來(lái)的)

[root@localhost local]# yum remove nginx

?注意:下麵是安裝依賴(lài)包(linux源碼安裝的時(shí)候需要安裝依賴(lài)包,如果安裝了就跳過(guò))

[root@localhost /]# yum install -y gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*

二、將安裝包文件上傳到/usr/local中執(zhí)行以下操作

[root@localhost local]# cd /usr/local [root@localhost local]# tar -zxv -f nginx-1.6.0.tar.gz [root@localhost local]# rm -rf nginx-1.6.0.tar.gz [root@localhost local]# mv nginx-1.6.0 nginx [root@localhost local]# cd /usr/local/nginx-1.6.0 [root@localhost nginx-1.6.0]# ./configure --prefix=/usr/local/nginx [root@localhost nginx-1.6.0]# make [root@localhost nginx-1.6.0]# make install

提示錯(cuò)誤時(shí):

./configure: error: the HTTP cache module requires md5 functions

?from OpenSSL library.?? You can either disable the module by using

?--without-http-cache option, or install the OpenSSL library into the system,

?or build the OpenSSL library statically from the source with nginx by using

?--with-http_ssl_module --with-openssl=<path> options.

這個(gè)因?yàn)榈谝淮伟惭bnginx,缺少了依賴(lài)包,需要安裝:

[root@localhost nginx-1.6.0]# yum -y install pcre-devel openssl openssl-deve
.... [root@localhost nginx-1.6.0]# ./configure --prefix=/usr/local/nginx .... [root@localhost nginx-1.6.0]#make && make install
....

?三、配置

#修改防火墻配置:

[root@localhost nginx-1.6.0]# vi + /etc/sysconfig/iptables #添加配置項(xiàng) -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #重啟防火墻 [root@localhost nginx-1.6.0]# service iptables restart

?四、啟動(dòng)

#方法1 [root@localhost nginx-1.6.0]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf #方法2 [root@localhost nginx-1.6.0]# cd /usr/local/nginx/sbin [root@localhost sbin]# ./nginx 重啟: [root@localhost local]#/usr/local/nginx/sbin/nginx -t [root@localhost local]#/usr/local/nginx/sbin/nginx -s reload

?

五、測(cè)試是否安裝成功

1、查看nginx的進(jìn)程:

[root@localhost conf]# ps -ef | grep nginx

?

2、?在瀏覽器中輸入:http://ip:端口 如果看到nginx的歡迎頁(yè)面表示安裝成功,如果頁(yè)面大不開(kāi),請(qǐng)關(guān)閉防火墻繼續(xù)測(cè)試
3、?關(guān)閉防火墻
(1) 重啟后永久性生效:??
????? 開(kāi)啟:chkconfig iptables on??
????? 關(guān)閉:chkconfig iptables off??
(2) 即時(shí)生效,重啟后失效:?
????? 開(kāi)啟:service iptables start??
????? 關(guān)閉:service iptables stop

nginx安裝好后如果需要開(kāi)機(jī)重啟nginx請(qǐng)看 》》 linux下安裝nginx后開(kāi)機(jī)啟動(dòng)篇

轉(zhuǎn)載于:https://www.cnblogs.com/mayi168/p/3866278.html

總結(jié)

以上是生活随笔為你收集整理的CentOs6.5下独立安装Nginx篇的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。