赞
踩
yum -y install openssl openssl-devel
./configure --prefix=/usr/local/nginx
--with-http_stub_status_module
--with-http_ssl_module
注意是备份原有已安装好的nginx启动文件
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
cp ./objs/nginx /usr/local/nginx/sbin/
/usr/local/nginx/sbin/nginx -V
user clw; worker_processes 10; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; #gzip on; upstream web777 { server 192.168.126.100:82 max_fails=3 fail_timeout=30s; } server { listen 80; server_name www.XXXX.com; rewrite ^(.*) https://$host$1 permanent;//用于将http协议强制跳转成https协议 error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } # HTTPS server server { listen 443 ssl;//开启ssl端口 server_name www.XXXX.com; ssl_certificate /usr/local/nginx/conf/ssl/server.crt; ssl_certificate_key /usr/local/nginx/conf/ssl/server.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; location / { root /usr/local/call/web; try_files $uri $uri/ /index.html; index index.html; } location /api/ { rewrite ^/api/(.*)$ /$1 break; proxy_pass http://web777; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header HTTP_X_FORWARDED_FOR $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_redirect default; } } } |
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。