Skip to content

Instantly share code, notes, and snippets.

@arzola
Created September 26, 2017 23:18
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 arzola/c643b7a62ba50d4d180edd39f772eb18 to your computer and use it in GitHub Desktop.
Save arzola/c643b7a62ba50d4d180edd39f772eb18 to your computer and use it in GitHub Desktop.
Nginx Server with SSL
server{
server_name gestor.dev;
listen 80;
root /Users/arzola/Sites/gestor/public;
error_log /Users/arzola/Sites/logs/gestor.log;
index index.htm index.php;
location / {
try_files $uri $uri/ /index.php;
autoindex on;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
location ~* /(.git|cache|bin|logs|backups|tests)/.*$ { return 403; }
location ~* /(system|vendor|config)/.*\.(txt|xml|md|html|yaml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
location ~* /user/.*\.(txt|md|yaml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
location ~ /(LICENSE.txt|composer.lock|composer.json|nginx.conf|web.config|htaccess.txt|\.htaccess) { return 403; }
}
server {
listen 443;
ssl on;
ssl_certificate /etc/ssl/certs/myssl.crt;
ssl_certificate_key /etc/ssl/private/myssl.key;
index index.htm index.php;
server_name gestor.dev;
root /Users/arzola/Sites/gestor/public;
location / {
try_files $uri $uri/ /index.php;
autoindex on;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
location ~* /(.git|cache|bin|logs|backups|tests)/.*$ { return 403; }
location ~* /(system|vendor|config)/.*\.(txt|xml|md|html|yaml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
location ~* /user/.*\.(txt|md|yaml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
location ~ /(LICENSE.txt|composer.lock|composer.json|nginx.conf|web.config|htaccess.txt|\.htaccess) { return 403; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment