Created
January 2, 2013 19:43
-
-
Save rolandboon/4437294 to your computer and use it in GitHub Desktop.
Example config file for a php vhost on nginx, implementing a couple of best practices from http://wiki.nginx.org/Pitfalls.
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 www.domain.com; | |
root /home/vhosts/www.domain.com/public; | |
location / { | |
index index.php index.html index.htm index.phtml; | |
try_files $uri $uri/ /index.php; # http://wiki.nginx.org/Pitfalls#Check_IF_File_Exists | |
} | |
location ~ \.php$ { | |
try_files $uri =404; # http://wiki.nginx.org/Pitfalls#Passing_Uncontrolled_Requests_to_PHP | |
fastcgi_pass 127.0.0.1:49232; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # http://wiki.nginx.org/Pitfalls#FastCGI_Path_in_Script_Filename | |
include /etc/nginx/fastcgi_params; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment