Skip to content

Instantly share code, notes, and snippets.

@sistematico
Created April 5, 2019 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sistematico/4c797898d503d60095325502318dc18c to your computer and use it in GitHub Desktop.
Save sistematico/4c797898d503d60095325502318dc18c to your computer and use it in GitHub Desktop.
Nginx Config
server {
listen 80;
listen [::]:80;
server_name lucasbrum.net *.lucasbrum.net;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
ssl_certificate /etc/ssl/nginx/lucasbrum.net.pem;
ssl_certificate_key /etc/ssl/nginx/lucasbrum.net-key.pem;
root /var/www/lucasbrum.net;
server_name lucasbrum.net *.lucasbrum.net;
location / {
try_files $uri $uri.html $uri/ @extensionless-php;
index index.html index.htm index.php;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location @extensionless-php {
rewrite ^(.*)$ $1.php last;
}
error_page 404 $scheme://$host/404.html;
error_page 403 $scheme://$host/403.html;
error_page 500 502 503 504 $scheme://$host/50x.html;
location ~ /\.ht { deny all; }
location ~ /.git/ { deny all; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment