Created
December 6, 2013 23:46
-
-
Save chriskief/7834139 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
upstream php { | |
server unix:/var/run/php5-fpm.sock; | |
} | |
server { | |
# enforce NO www | |
server_name www.example.com; | |
return 301 $scheme://example.com$request_uri; | |
} | |
server { | |
listen 80; | |
server_name example.com; | |
root /home/webapps/www.example.com/; | |
access_log /var/log/nginx/www.example.com.access.log main; | |
location / { | |
index index.php; | |
# pass requests to the front controller (http://wiki.nginx.org/Pitfalls#Front_Controller_Pattern_based_packages) | |
# but don't proxy everything (http://wiki.nginx.org/Pitfalls#Proxy_Everything) | |
try_files $uri $uri/ /index.php; | |
} | |
location ~ \.php$ { | |
# dont pass uncontrolled requests to php (http://wiki.nginx.org/Pitfalls#Passing_Uncontrolled_Requests_to_PHP) | |
try_files $uri =404; | |
fastcgi_pass php; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include /etc/nginx/fastcgi_params; | |
} | |
# deny access to .htaccess files | |
location ~ /\.ht { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment