server { server_name wp-dev.lawcarta.com wp-dev.livecarta.com; root /var/www/WordPress/htdocs/; index index.html index.php; error_log /var/log/nginx/wordpress-error.log; if (!-e $request_filename) { rewrite /wp-admin$ $scheme://$host$uri/ permanent; rewrite ^(/[^/]+)?(/wp-.*) $2 last; rewrite ^(/[^/]+)?(/.*\.php) $2 last; } location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { try_files $uri =404; include fastcgi.conf; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_pass unix:/run/php/php7.1-fpm.sock; fastcgi_read_timeout 300; } location ~ /\.ht { deny all; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/dev1.lawcarta.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/dev1.lawcarta.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot if ($scheme != "https") { return 301 https://$host$request_uri; } # managed by Certbot } server { if ($host = wp-dev.livecarta.com) { return 301 https://$host$request_uri; } # managed by Certbot if ($host = wp-dev.lawcarta.com) { return 301 https://$host$request_uri; } # managed by Certbot listen 80; listen [::]:80; server_name wp-dev.lawcarta.com wp-dev.livecarta.com; return 404; # managed by Certbot }