Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- server {
- listen 443 ssl http2;
- listen [::]:443 ssl http2;
- server_name example.com;
- set $base /var/www/example.com;
- root $base/public;
- # SSL
- ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
- ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
- ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
- # security
- include nginxconfig.io/security.conf;
- # index.php
- index index.php;
- # index.php fallback
- location / {
- try_files $uri $uri/ /index.php?$query_string;
- }
- # handle .php
- location ~ \.php$ {
- include nginxconfig.io/php_fastcgi.conf;
- }
- # additional config
- include nginxconfig.io/general.conf;
- }
- # subdomains redirect
- server {
- listen 443 ssl http2;
- listen [::]:443 ssl http2;
- server_name *.example.com;
- # SSL
- ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
- ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
- ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
- return 301 https://example.com$request_uri;
- }
- # HTTP redirect
- server {
- listen 80;
- listen [::]:80;
- server_name .example.com;
- include nginxconfig.io/letsencrypt.conf;
- location / {
- return 301 https://example.com$request_uri;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement