切换到进入的解压缩目录
[root@iz2zecue91mx9mhsl26o1fz nginx-1.14.0]# pwd
/root/test/nginx-1.14.0
[root@iz2zecue91mx9mhsl26o1fz nginx-1.14.0]#
useradd -s /sbin/nologin -M www
./configure --prefix=/app/nginx-1.14.0 --user=www --group=www --with-http_stub_status_module --with-http_ssl_module
make make install
启动nginx (端口号80)
[root@iz2zecue91mx9mhsl26o1fz nginx-1.14.0]# /app/nginx-1.14.0/sbin/nginx 查看端口号是否开启 lsof -i:80
#关闭防火墙
##临时
/etc/init.d/iptables stop
/etc/init.d/iptables stop
##永久-关闭(开机自启动)
chkconfig iptables off
##临时
/etc/init.d/iptables stop
/etc/init.d/iptables stop
##永久-关闭(开机自启动)
chkconfig iptables off
关闭selinux
vim /etc/selinux/config
##临时修改生效 (临时生效用,重启不方便)
setenforce 0
setenforce 0
永久生效是重启服务器
报错解决:
需要XX library 那么 就 yum install 库小写 +-devel #报错1 #./configure: error: the HTTP rewrite module requires the PCRE library. yum install pcre-devel -y #报错2 #./configure: error: SSL modules require the OpenSSL library. yum install openssl-devel -y
清空空行与#
egrep -v "^$|#" /app/nginx-1.14.0/conf/nginx.conf.default >/app/nginx-1.14.0/conf/nginx.conf
创建软连接
ln -s /app/nginx-1.14.0/sbin/nginx /sbin/
重启
[root@py-fullstack-10 ~]# nginx -s reload (修改完nginx.conf后需要重启否则不生效)
mkdir -p /app/nginx-1.14.0/html/{www,blog}
echo 'www.pythonav.com' > /app/nginx-1.14.0/html/www/index.html
学习的命令
vimdiff nginx.conf nginx.conf.bak
比较两个文件差异