zlib tro fire man eve conf source pub lis
centos7
- # 安装gcc,输入gcc -v 查询版本信息,看系统是否已经安装
- yum install gcc
- # 安装pcre
- yum install pcre-devel -y
- # 安装zlib
- yum install zlib zlib-devel -y
- # 安装openssl,如需支持ssl,才需安装openssl
- yum install openssl openssl-devel -y
- # 安装wget
- yum install wget
- # 下载nginx源码包
- wget https://nginx.org/download/nginx-1.12.2.tar.gz
- tar -zxvf nginx-1.12.2.tar.gz
- rm -rf nginx-1.12.2.tar.gz
- # 安装nginx
- cd nginx-1.12.2
- ./configure
- make
- make install
- # 测试配置文件
- /usr/local/nginx/sbin/nginx -t
- # 启动
- /usr/local/nginx/sbin/nginx
- # 停止
- /usr/local/nginx/sbin/nginx -s stop # 或者是 nginx -s quit
- # 重启命令
- /usr/local/nginx/sbin/nginx -s reload
restart.sh
- #!/bin/bash
- running=`ps -ef | grep -v 'grep' | grep '/usr/local/nginx/sbin/nginx'`
- if [[ -z ${running} ]]; then
- /usr/local/nginx/sbin/nginx
- else
- /usr/local/nginx/sbin/nginx -s stop
- /usr/local/nginx/sbin/nginx
- fi
check.sh
- #!/bin/bash
- ps -ef | grep -v 'grep' | grep --color "nginx.*process"
- firewall-cmd --permanent --zone=public --add-port=8090/tcp
- firewall-cmd --permanent --zone=public --remove-port=8080/tcp
- firewall-cmd --reload
- firewall-cmd --zone=public --list-ports
- server {
- listen 8090;
- server_name localhost;
- location / {
- proxy_pass http: //localhost:8080/;
- }
- }
关闭 8080 端口后,访问 http://192.168.1.103:8080 失败,访问 http://192.168.1.103:8090/ 正常
nginx
来源: http://www.bubuko.com/infodetail-2450668.html