且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

nginx 域名转向

更新时间:2022-09-17 07:52:50

 location /{

rewrite ^/(.*)$ http://www.1314it.com$1 permanent;
break;
#rewrite " ^/(.*)$" /index/$1 last;
#rewrite ^/test-([0-9]+).html$ /test.php?id=$1 last;
}


= = = = =

server
{
listen       80;
server_name 1314it.com;
index index.html index.htm index.php;
root  /web/site/www.1314it.com;
# rewrite ^/Index/index/get/(.*)& /index.php/Index/index/get/$1/Index/index/get/$1 last;
#limit_conn   crawler  20;


location /{

rewrite ^/(.*)$ http://www.1314it.com$1 permanent;
break;
#rewrite " ^/(.*)$" /index/$1 last;
#rewrite ^/test-([0-9]+).html$ /test.php?id=$1 last;
}

location /status {
stub_status on;
access_log off;
}

location ~ /.php
{
include fastcgi_params;
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?/.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME /web/site/www.1314it.com/$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
include fcgi.conf;
}

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

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

log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log  /usr/local/webserver/nginx/logs/access.log  access;
}