Created
September 26, 2017 23:18
-
-
Save arzola/c643b7a62ba50d4d180edd39f772eb18 to your computer and use it in GitHub Desktop.
Nginx Server with SSL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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