1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| server { listen 80; # 请求域名 server_name xxx.com; # rewrite 用于将所有http请求自动转换为https rewrite ^(.*)$ https://$host$1 permanent; root /web; location / { root /web/public; index index.html; } }
server { # Https默认请求端口 listen 443 ssl; # 请求域名 server_name xxx.com;
location / { # 项目根目录 root /web/public; # 请求主页名 会与上面的路径拼接获取对应文件 index index.html; } # 证书pem与key文件的位置 ssl_certificate pem_path; ssl_certificate_key key_path; ssl_session_timeout 5m; # 加密套件类型 ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; # TLS协议类型 ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on;
error_page 404 /404.html; location = /40x.html { root /web/html; }
error_page 500 502 503 504 /50x.html; location = /50x.html { root /web/html; } }
|