nginx下配置重写模式

废话不多说直接上代码:

server
{
server_name www.yourwebside.com;
index index.html index.htm index.php;
root /your/webside/path/;
fastcgi_connect_timeout 3600;
fastcgi_read_timeout 3600;
fastcgi_send_timeout 3600;
#error_page 404 /404.html;
include enable-php.conf;

location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}

location /nginx_status
{
stub_status on;
access_log off;
}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}

location ~ .*\.(js|css)?$
{
expires 12h;
}

location ~ /\.
{
deny all;
}

access_log /home/wwwlogs/access.log;
}

 

———————分割线———————

其中重写的部分为

location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}