VPS侦探论坛

 找回密码
 注册
查看: 8032|回复: 9

求助301绑定域名,导致phpmyadmin无法访问,急!

[复制链接]
发表于 2012-2-1 11:14:57 | 显示全部楼层 |阅读模式

系统环境:军哥lnmp 0.8, Cent os 6.0 64位, linode 512 vps,discuz x2最新版问题描述:301定向导致phpmyadmin无法访问
故障详情:我在安装lnmp的时候绑定的是www.wasai.org(军哥教程建议绑定一个二级域名),建立虚拟主机时添加的是wasai.org,现在想把域名www.wasai.org重定向到wasai.org


nginx.conf内容是:
  1. server
  2.         {
  3.                 listen       80;
  4.                 server_name wasai.org;
  5.                 index index.html index.htm index.php;
  6.                 root  /home/wwwroot/wasai.org;
  7.                 include discuzx.conf;
复制代码
wasai.org.conf内容是:
  1. server
  2.         {
  3.                 listen       80;
  4.                 server_name wasai.org;
  5.                 index index.html index.htm index.php default.html default.htm default.php;
  6.                 root  /home/wwwroot/wasai.org;

  7.                 include discuzx.conf;
  8.                 location ~ .*\.(php|php5)?$
  9.                         {
  10.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  11.                                 fastcgi_index index.php;
  12.                                 include fcgi.conf;
  13.                         }

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

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

  22.                 access_log off;
  23.         }

  24. server {
  25.   listen 80;
  26.   server_name www.wasai.org;
  27.   rewrite ^/(.*) http://wasai.org/$1 permanent;
  28. }
复制代码
大家可能注意到了,nginx.conf的root设置的是/home/wwwroot/wasai.org,不是默认的/home/wwwroot/,因为我删除了安装lnmp后默认的那个index.html,导致访问www.wasai.org显示的是403错误。

现在解决了301重定向的问题,但因为root目录绑定在了/home/wwwroot/wasai.org,,导致我无法访问http://wasai.org/phpmyadmin

很矛盾呀!

想请教各位大虾,我现在想实现这种效果:
1 让wasai.org重定向到www.wasai.org(因为带www的是主流)

2 用户访问www.wasai.org和wasai.org不出现403错误

3 可正常访问http://www.wasai.org/phpmyadmin




该怎么设置nginx.conf和wasai.org.conf文件呢?

急!在线等!

[ 本帖最后由 王小安 于 2012-2-1 11:27 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2012-2-1 11:43:39 | 显示全部楼层


nginx.conf 里你改了主目录的位置肯定就无法访问phpmyadmin了。
phpmyadmin 都在 /home/wwwroot/ 下面
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2012-2-1 11:59:02 | 显示全部楼层

是的,我是绑定了新目录,因为如果绑定在/wwwroot,访问www.wasai.org就403了呀!
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2012-2-1 12:22:51 | 显示全部楼层



你没看到你一个域名绑定了2次吗
nginx.conf绑了一次,你再添加一次肯定不行啊!!

前面你也已经发过了,我建议安装时帮个二级域名,你前面帮个二级域名后面不久一点问题都没了
把ngin.conf里的域名改掉重启
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2012-2-1 13:00:50 | 显示全部楼层

军哥,能把修改后的代码直接贴出来吗?思路有点乱

军哥运维代购:http://shop63846532.taobao.com/

 楼主| 发表于 2012-2-1 13:27:33 | 显示全部楼层

我修改nginx.conf:
server

{

listen       80;

server_name www.wasai.org;

index index.html index.htm index.php;

root  /home/wwwroot/;

include discuzx.conf;


和wasai.org.conf:

  1. server
  2.         {
  3.                 listen       80;
  4.                 server_name www.wasai.org;
  5.                 index index.html index.htm index.php default.html default.htm default.php;
  6.                 root  /home/wwwroot/wasai.org;

  7.                 include discuzx.conf;
  8.                 location ~ .*\.(php|php5)?$
  9.                         {
  10.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  11.                                 fastcgi_index index.php;
  12.                                 include fcgi.conf;
  13.                         }

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

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

  22.                 access_log off;
  23.         }

  24. server {
  25.   listen 80;
  26.   server_name wasai.org;
  27.   rewrite ^/(.*) http://www.wasai.org/$1 permanent;
  28. }
复制代码



wasai.org是可以跳转到www.wasai.org,但首页是403错误了,绑定root目录没有index.html,因为我网站的内容全在/wasai.org文件夹里的,这就是矛盾的地方。
发表于 2012-2-1 14:08:31 | 显示全部楼层

把phpmyadmin这个目录放到你域名目录里面,然后重启lnmp应该可以吧
我VPS里面就这样放的
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2012-2-1 14:35:25 | 显示全部楼层

如果把phpmyadmin放到一个虚拟主机里,以后添加主机怎么办,那几个是所有主机共用的呀!
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2012-2-1 17:24:26 | 显示全部楼层

能不能将默认站点关闭。或设到别的目录。新建的网站可不可以放到其它目录。



能不能将默认站点关闭。或设到别的目录。
新建的网站可不可以放到其它目录。如/home2/wwwroot/
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2012-2-1 21:40:28 | 显示全部楼层



修改nginx.conf 里的域名换成一个二级域名就行了,phpmyadmin 用 http://二级域名/phpmyadmin/ 访问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-22 05:28 , Processed in 0.029352 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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