yum install pcre* yum install openssl* yum install zlib yum install zlib-devel yum install wget 查看是否已經安裝好 rpm -qa | grep "查看的內容" 2.開始安裝nginx wget http ...
- 安裝前先確認是否已經安裝編譯包和一些依賴包如果沒有安裝:
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 實踐總結出的 如果有什麼錯誤聯繫作者