🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
``` server { listen 443 ssl http2 ; ssl_certificate /usr/local/nginx/key/mtgo/full_chain.pem; ssl_certificate_key /usr/local/nginx/key/mtgo/private.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; listen 80 ; #listen [::]:80 default_server ipv6only=on; server_name www.xxjysxh.com; index index.html index.htm index.php; root /mydata/xxj/public; #error_page 404 /404.html; # Deny access to PHP files in specific directory #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; } include enable-php-pathinfo.conf; location /nginx_status { stub_status on; access_log off; } location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=/$1 last; break; } } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } location ~ /.well-known { allow all; } location ~ /\. { deny all; } access_log /home/wwwlogs/access.log; } ``` ​ ### 这个地方设置HTTPS,比较关键,不这样设置就报错,我的法克 ~~~ listen 443  ssl http2 ; ~~~ ![](data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw== "点击并拖拽以移动") ### 这个地方是设置证书的,证书需要绝对地址,通过命令 pwd 可以看到 ~~~ ssl_certificate /usr/local/nginx/key/mtgo/full_chain.pem; ssl_certificate_key /usr/local/nginx/key/mtgo/private.key; ~~~ ![](data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw== "点击并拖拽以移动") 推荐参考:[lnmpa设置https,访问时为此网站无法提供安全连接 - SegmentFault 思否](https://segmentfault.com/q/1010000009916925/a-1020000009917088 "lnmpa设置https,访问时为此网站无法提供安全连接 - SegmentFault 思否") ​