Skip to content

Instantly share code, notes, and snippets.

@singleseeker
Created November 19, 2012 04:03
Show Gist options
  • Save singleseeker/4108880 to your computer and use it in GitHub Desktop.
Save singleseeker/4108880 to your computer and use it in GitHub Desktop.
ngnix::conf-domain
log_format www.{{yoursiteurl}}.com '$remote_addr - $remote_user [$time_local] $request '
'$status $body_bytes_sent $http_referer '
'$http_user_agent $http_x_forwarded_for';
server
{
listen 80;
server_name www.{{yoursiteurl}}.com {{yoursiteurl}}.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/www.{{yoursiteurl}}.com;
location /blog
{
if (-f $request_filename/index.php)
{
rewrite (.*) $1/index.php;
}
if (!-f $request_filename)
{
rewrite ^/blog/(.*)$ /blog/index.php;
}
}
location ~ .*\.(php|php5)?$
{
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
if (-d $request_filename){ rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent; }
access_log /home/wwwlogs/www.{{yoursiteurl}}.com.log www.{{yoursiteurl}}.com;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment