Created
February 15, 2018 15:56
-
-
Save shellexy/29533150ce751ea5c0fca5de0ce35a47 to your computer and use it in GitHub Desktop.
nginx 示例配置由 certbot --webroot --installer nginx --redirect --keep --webroot-path 命令自动添加
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## nginx configuration | |
| server { | |
| listen 80; | |
| listen [::]:80; | |
| root /var/www/site.xxx.com; | |
| index index.php index.html index.htm index.nginx-debian.html; | |
| server_name site.xxx.com; | |
| location / { | |
| try_files $uri $uri/ /index.php?$args; | |
| } | |
| location ~ \.php$ { | |
| include snippets/fastcgi-php.conf; | |
| fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; | |
| } | |
| location ~ /\.ht { | |
| deny all; | |
| } | |
| ## 下边是由 certbot --webroot --installer nginx --redirect --keep --webroot-path 命令自动添加的 | |
| listen 443 ssl; # managed by Certbot | |
| ssl_certificate /etc/letsencrypt/live/site.xxx.com/fullchain.pem; # managed by Certbot | |
| ssl_certificate_key /etc/letsencrypt/live/site.xxx.com/privkey.pem; # managed by Certbot | |
| include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot | |
| ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot | |
| if ($scheme != "https") { | |
| return 301 https://$host$request_uri; | |
| } # managed by Certbot | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment