|
我想把对字符串“pet-supplies-c-988_1210.html“的访问转为”/pet-supplies-c-1150_1210.html“,用了下面这条规则:
rewrite ^(.*)pet-supplies-c-978_1210.html$ /pet-supplies-c-1120_1210.html last;
可是始终不跳转;而改为下面的规则就可以跳转了:
rewrite ^(.*)pet-supplies-c-978_1210.html$ http://192.168.3.1/pet-supplies-c-1120_1210.html last;
192.168.3.1是服务器IP,但是我不知道为什么要加上[url]http://192.168.3.1才会执行跳转,请高手帮忙。。。
下面是我的配置文件:
user daemon daemon;
worker_processes 5;
error_log logs/nginx_error.log crit;
pid logs/nginx.pid;
worker_rlimit_nofile 51200;
events
{
use epoll;
worker_connections 51200;
}
http
{
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
server
{
listen 80;
server_name www.huxy.com huxy.com;
index index.html index.htm index.php;
root /var/www;
error_page 404 /errorinfo.php;
error_page 403 /403.html;
rewrite ^(.*)pet-supplies-c-978_1210.html$ /pet-supplies-c-1120_1210.html last;
rewrite ^(.*)-p-(.*).html$ "/product_info.php?products_id=$2&%{QUERY_STRING}" last;
rewrite ^(.*)-p-(.*)/osCsid/(.*) /product_info.php?products_id=$2 last;
。。。。。。
location ~ .*\.(htm|html|gif|jpg|jpeg|png|bmp|ico|css|js|txt)$
{
root /var/www;
expires 24h;
}
location ~ .*\.php?$ {
include fcgi.conf;
fastcgi_pass 127.0.0.1:11180;
fastcgi_index index.php;
}
location /NginxStatus
{
stub_status on;
access_log off;
auth_basic "NginxStatus";
auth_basic_user_file ./vhost/htpasswd;
}
}
} |
|