Skip to content

Instantly share code, notes, and snippets.

@Jerry-Lau Jerry-Lau/phpdemo.conf

Last active Aug 24, 2017
What would you like to do?
Nginx PHP configuration
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_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
location ~ /\. {
deny all;

This comment has been minimized.

Copy link
Owner Author

Jerry-Lau commented Aug 24, 2017

The location ~ /. directive is very important to include. This prevents Nginx from printing the contents of files like .htaccess and .htpasswd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.