Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Accepted Answer
Unless you have a specific need, you shouldn’t be clustering the location blocks are you currently are. You need to separate / from others.
So you’re location blocks should look like this:
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location /monit/ {
rewrite ^/monit/(.*) /$1 break;
proxy_ignore_client_abort on;
proxy_pass http://localhost:2812;
}
Though I would organize the configuration a little more, which I’ve done for you below.
server {
listen 80;
server_name SERVER.COM;
return 301 https://$host$request_uri;
location /.well-known {
alias /var/www/DIR/.well-known;
}
}
server {
listen 443;
server_name SERVER.COM;
root /var/www/SERVER.COM/;
index index.php index.html index.htm;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
ssl on;
ssl_certificate /etc/letsencrypt/live/SERVER.COM/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/SERVER.COM/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location /monit/ {
rewrite ^/monit/(.*) /$1 break;
proxy_ignore_client_abort on;
proxy_pass http://localhost:2812;
}
}
After changing the configuration, you’ll need to reload or restart NGINX.