Last active
December 16, 2015 07:18
-
-
Save richardkall/5397279 to your computer and use it in GitHub Desktop.
Nginx + PHP5
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
charset utf-8; | |
gzip_disable "msie6"; | |
gzip_types text/plain text/css application/x-javascript application/xml text/javascript; | |
# www.example.com | |
server { | |
listen 80; | |
server_name *.example.com; | |
rewrite ^(.*) http://example.com$1 permanent; | |
} | |
# example.com | |
server { | |
listen 80; | |
server_name example.com; | |
index index.php index.html; | |
root /var/www/example.com/html; | |
access_log /var/www/example.com/logs/access.log; | |
error_log /var/www/example.com/logs/error.log; | |
location ~ \.php$ { | |
fastcgi_index index.php; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
include fastcgi_params; | |
} | |
# Deny access to hidden files | |
location ~ /\. { | |
deny all; | |
} | |
# Remove index.php from URLs | |
location / { | |
try_files $uri $uri/ /index.php?$args; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment