建立主机时绑定了XXXX.com,然后让www.XXXX.com跳转到XXXX.com,应用了typecho的rewrite规则。
现在出现个问题,用www.XXXX.com访问时,跳转到XXXX.com//index.php,多了个/,404了。。。
改哪里的配置可以解决?
现在出现个问题,用www.XXXX.com访问时,跳转到XXXX.com//index.php,多了个/,404了。。。
改哪里的配置可以解决?
3 Answers
/usr/local/nginx/conf/vhost/www.xxx.com.conf #虚拟主机配置文件
/usr/local/nginx/conf/typeho.conf #伪静态
/usr/local/nginx/conf/typeho.conf #伪静态
#zxcv.com.conf
server {
listen 80;
server_name zxcv.com http://www.zxcv.com;
access_log off;
index index.html index.htm index.php;
include /usr/local/nginx/conf/typecho.conf;
root /data/wwwroot/zxcv.com;
if ($host != zxcv.com) {
rewrite ^/(.*)$ $scheme://zxcv.com/$1 permanent;
}
location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv)$ {
valid_referers none blocked *.zxcv.com zxcv.com http://www.zxcv.com;
if ($invalid_referer) {
#rewrite ^/ http://www.linuxeye.com/403.html;
return 403;
}
}
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
}
#typecho.conf
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-e $request_filename){
rewrite (.*) /index.php;
}
server {
listen 80;
server_name zxcv.com http://www.zxcv.com;
access_log off;
index index.html index.htm index.php;
include /usr/local/nginx/conf/typecho.conf;
root /data/wwwroot/zxcv.com;
if ($host != zxcv.com) {
rewrite ^/(.*)$ $scheme://zxcv.com/$1 permanent;
}
location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv)$ {
valid_referers none blocked *.zxcv.com zxcv.com http://www.zxcv.com;
if ($invalid_referer) {
#rewrite ^/ http://www.linuxeye.com/403.html;
return 403;
}
}
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
}
#typecho.conf
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-e $request_filename){
rewrite (.*) /index.php;
}
Please login or Register to submit your answer