VPS侦探论坛

 找回密码
 注册
查看: 5136|回复: 2

关于LNMPA网页状态

[复制链接]
发表于 2013-9-1 23:49:35 | 显示全部楼层 |阅读模式

网址:www.bilpage.com bilpage.com      现在的状态是:www的跳转到不带WWW上面,状态301。不带www,状态200。这个www的是不是不正常?我想要两个都是200要怎么弄?

apache的VHOST:
文件名:www.bilpage.com.conf
内容:
<VirtualHost *:88>
ServerAdmin webmaster@example.com
php_admin_value open_basedir "/home/wwwroot/wp:/tmp/:/var/tmp/:/proc/"
DocumentRoot "/home/wwwroot/wp"
ServerName www.bilpage.com
ServerAlias bilpage.com
</VirtualHost>



nginx的VHOST:
文件名:www.bilpage.com.conf
内容:
log_format  www.bilpage.com.log  '$remote_addr - $remote_user [$time_local] "$request" '
             '$status $body_bytes_sent "$http_referer" '
             '"$http_user_agent" $http_x_forwarded_for';
server
        {
                listen       80;
                server_name www.bilpage.com bilpage.com;
                index index.html index.htm index.php default.html default.htm default.php;
                root  /home/wwwroot/wp;

                location / {
                        try_files $uri @apache;
                        }

                location @apache {
                        internal;
                        proxy_pass http://127.0.0.1:88;
                        include proxy.conf;
                        }

                location ~ .*\.(php|php5)?$
                        {
                                proxy_pass http://127.0.0.1:88;
                                include proxy.conf;
                        }

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

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

                access_log  off;
        }

[ 本帖最后由 ilmin 于 2013-9-1 23:51 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2013-9-2 10:09:15 | 显示全部楼层


前面帖子我已经说过了,除非设置了301或程序上加了301

配置上没问题,基本上就是程序的问题。

看你程序上是wp,你在wp设置的是不带www为主域名,所有访问带www的域名会先有301了

root@vpser:~# curl -IL bilpage.com
HTTP/1.1 200 OK
Server: nginx/1.2.7
Date: Mon, 02 Sep 2013 02:00:34 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.2.17p1
X-Pingback: http://bilpage.com/xmlrpc.php

root@vpser:~# curl -IL www.bilpage.com
HTTP/1.1 301 Moved Permanently
Server: nginx/1.2.7
Date: Mon, 02 Sep 2013 02:00:40 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/5.2.17p1
X-Pingback: http://bilpage.com/xmlrpc.php
Location: http://bilpage.com/

HTTP/1.1 200 OK
Server: nginx/1.2.7
Date: Mon, 02 Sep 2013 02:00:41 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.2.17p1
X-Pingback: http://bilpage.com/xmlrpc.php
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2013-9-2 23:14:50 | 显示全部楼层

谢谢军哥
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-24 23:24 , Processed in 0.026297 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表