🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
https-SSL 配置 ``` server{ listen 443 ssl; ssl on; server_name 域名; ssl_certificate /etc/nginx/conf.d/cert/3161512_xxx.pem; #将domain name.pem替换成您证书的文件名。 ssl_certificate_key /etc/nginx/conf.d/cert/3161512_xxx.key; #将domain name.key替换成您证书的密钥文件名。 ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; #使用此加密套件。 ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #使用该协议进行配置。 ssl_prefer_server_ciphers on; location /activity { alias /data/activity/; try_files $uri /index.html; index index.html; } location / { alias /data/app/home/; try_files $uri /index.html; index index.html; } location ~* ^/(css|img|js|flv|swf)/(.+)$ { root $root; } location ~ /\.ht { deny all; } } ``` 为了方便版本切换目录 /data/app/home/ 做软连接 ln -s 版本1.0 home 如:切换版本 可用 rm home 先删除再使用 ln -s 版本2.0 home,快捷方式 rm home && ln -s 版本2.0 home 这么做的用处防止用户访问时出现504,回滚你懂的。 http的配置把ssl的配置干掉就可以 ``` server{ listen 80; server_name 域名; set $root '/data/app/home'; root $root; index index.html; location / { try_files $uri $uri/ /index.html?$args; proxy_read_timeout 150; client_max_body_size 100m; } location ~* ^/(css|img|js|flv|swf)/(.+)$ { root $root; } location ~ /\.ht { deny all; } } ``` https-http合并为一个配置,增加监听就行 ``` server{ listen 80; listen 443 ssl; ssl on; server_name 域名; ssl_certificate /etc/nginx/conf.d/cert/3161512_xxx.pem; #将domain name.pem替换成您证书的文件名。 ssl_certificate_key /etc/nginx/conf.d/cert/3161512_xxx.key; #将domain name.key替换成您证书的密钥文件名。 ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; #使用此加密套件。 ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #使用该协议进行配置。 ssl_prefer_server_ciphers on; location /activity { alias /data/activity/; try_files $uri /index.html; index index.html; } location / { alias /data/app/home/; try_files $uri /index.html; index index.html; } location ~* ^/(css|img|js|flv|swf)/(.+)$ { root $root; } location ~ /\.ht { deny all; } } ```