- #########http###########
- server{
- listen 80; #监听的端口号
- server_name pazzn.com www.pazzn.com; #您的域名
- return 301 https://www.pazzn.com$request_uri; #### 强制将 80 端口的流量跳转到这个 https 指定网址
- location / {
- root /home/www/pazzn; #站点的路径
- index index.PHP index.html index.htm;
- if (!-e $request_filename) {
- rewrite ^(.*)$ /index.PHP$1 last;
- }
- }
- location ~ ^.+\.PHP {
- root /home/www/pazzn; #站点的路径
- fastcgi_pass 127.0.0.1:9000; #根据自己的 PHP-fpm 配置填写
- fastcgi_index index.PHP;
- ### 配置支持 pathinfo
- fastcgi_split_path_info ^((?U).+\.PHP)(/?.+)$;
- fastcgi_param PATH_INFO $fastcgi_path_info;
- fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
- }
- ###########https####
- server{
- listen 443; #监听的端口号
- server_name www.pazzn.com; #您的域名
- ssl on;
- ssl_certificate /etc/letsencrypt/live/www.pazzn.com/fullchain.pem; ### 其他沃通申请的证书在 nginx 也是改这个路径
- ssl_certificate_key /etc/letsencrypt/live/www.pazzn.com/privkey.pem; ### 其他沃通申请的证书在 nginx 也是改这个路径
- location / {
- root /home/www/pazzn; #站点的路径
- index index.PHP index.HTML index.htm;
- if (!-e $request_filename) {
- rewrite ^(.*)$ /index.PHP$1 last;
- }
- }
- location ~ ^.+\.PHP {
- root /home/www/pazzn; #站点的路径
- fastcgi_pass 127.0.0.1:9000; #根据自己的 PHP-fpm 配置填写
- fastcgi_index index.PHP;
- ### 配置支持 pathinfo
- fastcgi_split_path_info ^((?U).+\.PHP)(/?.+)$;
- fastcgi_param PATH_INFO $fastcgi_path_info;
- fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
- }
证书连接: https://www.qikqiak.com/post/make-https-blog/
来源: http://www.bubuko.com/infodetail-3112913.html