Last active
August 24, 2017 06:24
-
-
Save jerrylau91/ee76b21a8679557d4cf8179dc5b26966 to your computer and use it in GitHub Desktop.
Nginx PHP configuration
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 { | |
listen 8090; | |
server_name localhost; | |
root /Users/jerryliu/Coding/myapp/phpdemo01; | |
index index.php index.html index.htm; | |
autoindex off; | |
location / { | |
try_files $uri $uri/ /index.php; | |
} | |
location ~ \.php$ { | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
location ~ /\. { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The location ~ /. directive is very important to include. This prevents Nginx from printing the contents of files like .htaccess and .htpasswd.