yum install pcre*
yum install openssl*
yum install zlib
yum install zlib-devel
yum install wget
查看是否已經安裝好 rpm -qa | grep "查看的內容"
2.開始安裝nginx
wget http://nginx.org/download/nginx-1.8.0.tar.gz
3. 解壓
如果你想把安裝包復制到別處 可以 cp nginx-1.8.0.tar.gz 路徑(例如/usr/local)
tar -zxvf nginx-1.8.0.tar.gz
4.解壓完畢開始安裝
cd nginx-1.8.0
./configure --prefix=/opt/nginx --with-http_stub_status_module // --prefix=/opt/nginx 這個是指定安裝路徑
5.啟動nginx 我這裡安裝在了opt/nginx
cd /opt/nginx
./nginx //如果執行此步驟時出現端口被占用 :
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
我這裡是80端口被占用了查看哪些占用了80端口
fuser -n tcp 80
返回消息是80/tcp: 12965 12966
然後通過 kill -9 刪除進程
kill -9 12965
kill -9 12966
然後再啟動nginx
./nginx
此文章是綜合 http://happyqing.iteye.com/blog/1806561 http://jingyan.baidu.com/article/1974b2898f5eadf4b1f774de.html http://www.laozuo.org/3510.html 實踐總結出的 如果有什麼錯誤聯系作者
http://xxxxxx/Linuxjc/1177348.html TechArticle