日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Nginx >内容正文

Nginx

CentOs6.5下独立安装Nginx篇

發布時間:2025/7/14 Nginx 50 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CentOs6.5下独立安装Nginx篇 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一、檢查系統是否安裝了Nginx

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

(如果已經安裝了nginx就卸載掉原來的)

[root@localhost local]# yum remove nginx

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

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

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

[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

提示錯誤時:

./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.

這個因為第一次安裝nginx,缺少了依賴包,需要安裝:

[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 #添加配置項 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #重啟防火墻 [root@localhost nginx-1.6.0]# service iptables restart

?四、啟動

#方法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

?

五、測試是否安裝成功

1、查看nginx的進程:

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

?

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

nginx安裝好后如果需要開機重啟nginx請看 》》 linux下安裝nginx后開機啟動篇

轉載于:https://www.cnblogs.com/mayi168/p/3866278.html

總結

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

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。