linux centos 安装 NGINX方法及bug解决:
1、yum install gcc gcc-c++ make
2、下载:wget http://nginx.org/download/nginx-1.8.1.tar.gz wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
3、解压:tar -zxvf nginx-1.8.1.tar.gz unzip master.zip
4、./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-master --(错误:./configure: error: the HTTP rewrite module requires the PCRE library...... 解决办法:下载包(https://ftp.pcre.org/pub/pcre/)=》安装(
tar zxvf pcre-8.39.tar.gz
cd pcre-8.39
./configure
make
make install
))
5、make --(错误:make: *** No rule to make target `build', needed by `default'. Stop.解决办法:同4错误解决办法,而后重新执行4的./configure)
6、make install
7、安装开机启动脚本:sudo wget https://raw.github.com/JasonGiedymin/nginx-init-ubuntu/master/nginx -O /etc/init.d/nginx (移动下载 的文件到(-o)init.d/nginx目录去)
8、chmod +x /etc/init.d/nginx
9、update-rc.d nginx defaults ()
10、sudo service nginx start (错误:start-deamon not found 解决:安装deamon :https://blog.creke.net/776.html (
wget http://developer.axis.com/download/distribution/apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz
tar zxf apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz
mv apps/sys-utils/start-stop-daemon-IR1_9_18-2/ ./
rm -rf apps
cd start-stop-daemon-IR1_9_18-2/
cc start-stop-daemon.c -o start-stop-daemon
cp start-stop-daemon /usr/local/bin/start-stop-daemon
);
错误:/etc/init.d/nginx: line 210: log_daemon_msg: command not found
/etc/init.d/nginx: line 226: log_end_msg: command not found
解决:
)
sudo service nginx stop
11.直接按照此方法安装:https://my.oschina.net/AmosWang/blog/1547544 (错误:nginx command not found 解决: http://blog.leanote.com/post/qian_c/nginx-command-not-found:
修改环境变量
vim /etc/profile
# 增加nginx的执行文件路径
# nginx
export PATH="/usr/local/nginx/sbin:$PATH"
# 保存环境变量
source /etc/profile
验证nginx.conf配置文件是否正确
nginx -t
平滑重启
在nginx不停机的时候,进行相应的修改,来不影响服务器的运行
# 看生成环境也是用这命令,所以觉得应该是可以的:)
nginx -s reload
);
(错误:nginx重启 failed (98: Address already in use) 解决:https://blog.csdn.net/zqinghai/article/details/73484394 (netstat -ntpl kill 2347));
(错误:浏览器不能访问nginx 解决:https://blog.csdn.net/sinat_25957705/article/details/80641077 (阿里云端配置安全组规则,允许80端口));