1.yum -y install gcc pcre-devel zlib-devel openssl openssl-devel
2.nginx下载地址:https://nginx.org/download/
3.wget链接地址
4.tar -zxvf nginx-1.9.9.tar.gz
5../configure --prefix=/usr/local/nginx (如果需要ssl)
6.make 编译
7.make install 安装
8.附一个HTTPS 配置
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; # another virtual host using mix of IP-, name-, and port-based configuration # server{ listen 80; server_name iot.****.***.cn; location / { # proxy_pass http://127.0.0.1:8001/; root /usr/application/dist; index index.html index.htm; } # rewrite ^/(.*)$ https://iot.allsheng.com.cn:443/$1 permanent; } # HTTPS server # server { listen 443 ssl; server_name ***.***.com.cn; ssl on; ssl_certificate /usr/application/3681500_iot.allsheng.com.cn.pem; ssl_certificate_key /usr/application/3681500_iot.allsheng.com.cn.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location / { proxy_pass http://127.0.0.1:8001/; # root /usr/application/dist; # index index.html index.htm; } } }
9.相关命令
1.nginx -s stop
2.nginx -s reload