用了LNMP方案,出现域名跳转问题

问答中心分类: OneinStack用了LNMP方案,出现域名跳转问题
匿名用户 asked 9 年 ago
建立主机时绑定了XXXX.com,然后让www.XXXX.com跳转到XXXX.com,应用了typecho的rewrite规则。
现在出现个问题,用www.XXXX.com访问时,跳转到XXXX.com//index.php,多了个/,404了。。。
改哪里的配置可以解决?

3 Answers
oneinstack answered 9 年 ago
/usr/local/nginx/conf/vhost/www.xxx.com.conf  #虚拟主机配置文件
/usr/local/nginx/conf/typeho.conf #伪静态

cj01036 answered 9 年 ago
#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;
}

cj01036 answered 9 年 ago
#zxcv.com.conf里的http:// 是木有的,发上来自动加上的。。。。
 
试试,请无视以下内容:
http://www.abc.com   abc.com
http://www.abc.com