Last active
January 6, 2016 16:15
-
-
Save freemanirl/9cce243a94ed376092a5 to your computer and use it in GitHub Desktop.
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 80; ## listen for ipv4; this line is default and implied | |
#server_name "~^(?<sub>.+)\.something\.com$"; | |
#root /var/www/$sub/current/public; | |
server_name something.com; | |
root /var/www/site/current/public; | |
index index.html index.htm index.php; | |
# serve static files directly | |
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ { | |
access_log off; | |
#expires max; | |
} | |
# removes trailing slashes (prevents SEO duplicate content issues) | |
if (!-d $request_filename) | |
{ | |
rewrite ^/(.+)/$ /$1 permanent; | |
} | |
# removes trailing "index" from all controllers | |
if ($request_uri ~* index/?$) | |
{ | |
rewrite ^/(.*)/index/?$ /$1 permanent; | |
} | |
# unless the request is for a valid file (image, js, css, etc.), send to bootstrap | |
if (!-e $request_filename) | |
{ | |
rewrite ^/(.*)$ /index.php?/$1 last; | |
break; | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root html; | |
} | |
location ~* \.php$ { | |
try_files $uri $uri/ /index.php?$query_string; | |
fastcgi_index index.php; | |
#fastcgi_pass 127.0.0.1:9000; | |
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param SCRIPT_NAME $fastcgi_script_name; | |
} | |
location ~ /\.ht { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment