全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 3396|回复: 18
打印 上一主题 下一主题

[疑问] 呀,奇怪了,怎样这样啊。

[复制链接]
跳转到指定楼层
1#
发表于 2010-10-27 10:25:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
安装了 LNMP 0.5-CentOS/Debian下Nginx+MySQL+PHP一键安装包(5月21日再次更新)  
比如:
我的主域名是:www.123.com  目录是/home/wwwroot/
我添加了虚拟主机:www.3210.com  目录是在/home/wwwroot/3210/下面。
怎么我访问www.3210.com是访问到www.123.com目录的。(我可以保证,我添加域名的时候,是绑定到/home/wwwroot/3210/下面)

为什么会这样啊?因为域名是从另外一个IP解析过来,会不会是还没有生效啊。但我ping这个域名,ip已经显示是要绑定的这个IP了。
2#
发表于 2010-10-27 10:26:56 | 只看该作者
nginx.conf 看看
3#
发表于 2010-10-27 10:26:59 | 只看该作者
重启nginx
4#
发表于 2010-10-27 10:28:39 | 只看该作者
去/usr/local/nginx/conf/vhost/下面检查一下3210.com.conf文件。lnmp在绑定域名的时候,3210.com和www.3210.com不能自动绑定。

举例:server_name里面,要分别有m4go.com和www.m4go.com
  1. server
  2.         {
  3.                 listen       80;
  4.                 server_name m4go.com www.m4go.com;
  5.                 index index.html index.htm index.php default.html default.htm default.php;
  6.                 root  /home/wwwroot/m4go/m4go.com;

  7.                 include typecho.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.         }
复制代码
5#
 楼主| 发表于 2010-10-27 10:33:57 | 只看该作者
原帖由 小夜 于 2010-10-27 10:28 发表
去/usr/local/nginx/conf/vhost/下面检查一下3210.com.conf文件。lnmp在绑定域名的时候,3210.com和www.3210.com不能自动绑定。

举例:server_name里面,要分别有m4go.com和www.m4go.comserver
        {
                listen       80;
                s ...



没有问题。
  1. server
  2.         {
  3.                 listen       80;
  4.                 server_name www.3210.com 3210.com;
  5.                 index index.html index.htm index.php default.html default.htm default.php;
  6.                 root  /home/wwwroot/3210/;

  7.                 include none.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.         }
复制代码
6#
发表于 2010-10-27 10:35:16 | 只看该作者
你/root/reload 的时候,注意看有没有错误提示?
7#
 楼主| 发表于 2010-10-27 10:44:43 | 只看该作者
  1. [root@cncyw lnmp0.4-full]# ./vhost.sh
  2. =========================================================================
  3. Add Virtual Host for LNMP V0.4  ,  Written by Licess
  4. =========================================================================
  5. LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux
  6. This script is a tool to add virtual host for nginx
  7. For more information please visit http://www.lnmp.org/

  8. =========================================================================
  9. Please input domain:
  10. (Default domain: www.lnmp.org):www.XXX.com
  11. ===========================
  12. domain=www.XXX.com
  13. ===========================
  14. Do you want to add more domain name? (y/n)
  15. y
  16. Type domainname,example(bbs.vpser.net forums.vpser.net luntan.vpser.net):
  17. XXX.com
  18. ===========================
  19. domain list=XXX.com
  20. ===========================
  21. Please input the directory for the domain:www.XXX.com :
  22. (Default directory: /home/wwwroot/www.XXX.com):
  23. ===========================
  24. Virtual Host Directory=/home/wwwroot/www.XXX.com
  25. ===========================
  26. ===========================
  27. Allow Rewrite rule? (y/n)
  28. ===========================
  29. n
  30. ===========================
  31. You choose rewrite=none
  32. ===========================
  33. ===========================
  34. Allow access_log? (y/n)
  35. ===========================
  36. n
  37. ===========================
  38. You access log file=.log
  39. ===========================

  40. Press any key to start create virtul host...
  41. Create Virtul Host directory......
  42. set permissions of Virtual Host directory......
  43. You select the exist rewrite rule:/usr/local/nginx/conf/none.conf
  44. Test Nginx configure file......
  45. [emerg]: unknown directive "RewriteEngine" in /home/wwwroot/www.11111111.cn/.htaccess:2
  46. configuration file /usr/local/nginx/conf/nginx.conf test failed

  47. Restart Nginx......
  48. =========================================================================
  49. Add Virtual Host for LNMP V0.4  ,  Written by Licess
  50. =========================================================================
  51. For more information please visit http://www.lnmp.org/

  52. Your domain:www.XXX.com
  53. Directory of www.XXX.com:/home/wwwroot/www.XXX.com

  54. =========================================================================
复制代码

[ 本帖最后由 sujian919 于 2010-10-27 10:57 编辑 ]
8#
 楼主| 发表于 2010-10-27 10:48:27 | 只看该作者
重新绑定了。
  1. server
  2.         {
  3.                 listen       80;
  4.                 server_name www.XXX.com XXX.com;
  5.                 index index.html index.htm index.php default.html default.htm default.php;
  6.                 root  /home/wwwroot/www.XXX.com;

  7.                 include none.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.         }
复制代码
9#
 楼主| 发表于 2010-10-27 10:48:49 | 只看该作者
还是不行
10#
发表于 2010-10-27 10:51:14 | 只看该作者
Test Nginx configure file......
[emerg]: unknown directive "RewriteEngine" in /home/wwwroot/www.xy186.cn/.htaccess:2
configuration file /usr/local/nginx/conf/nginx.conf test failed

这段很明显,其中xy186.cn绑定错误。这样,你reload是没用的,你要重启nginx都起不来。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2025-10-29 08:23 , Processed in 0.195945 second(s), 10 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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