无标题文档
wdCP系统 (介绍,功能特性,运行环境,安装说明,演示,常见问题,使用教程) wdCDN系统 (介绍,功能特性,运行环境,安装说明,演示,常见问题,使用手册)
wdOS系统 (介绍,功能特性,运行环境,安装说明,演示,常见问题,使用教程) wdDNS系统 (介绍,功能特性,运行环境,安装说明,演示,常见问题,使用手册)
注册 发贴 提问 回复-必看必看 wddns免费智能 DNS 开通 本地或虚拟机使 用wdcp 一键包在mysql编 译时"卡住"
【300G高防】双线 无视攻击 wdcp官方技术支持/服务 阿里云8折优惠券 无敌云 腾讯云优惠中,现注册更有260代金额券赠送
返回列表 发帖
提问三步曲: 提问先看教程/FAQ索引(wdcp,wdcp_v3,一键包)及搜索,会让你更快解决问题
1 提供详细,如系统版本,wdcp版本,软件版本等及错误的详细信息,贴上论坛或截图发论坛
2 做过哪些操作或改动设置等

温馨提示:信息不详,很可能会没人理你!论坛有教程说明的,也可能没人理!因为,你懂的

[已解决] 无法wget,不能用vhost.sh命令。求解!

注意:如不是本人定制的系统及用本人的一键安装包,将没有这个命令
可以下载,如下方式:
wget http://www.wdlinux.cn/in_scripts/vhost.sh.txt
mv vhost.sh.txt /bin/vhost.sh
chmod 755 /bin/vhost.sh
就可以使用了

在本机VM上装好集成LNMP包,想用vhost.sh命令,但是发现没有用。


想重新下载却wget不到。。。

提示:
[root@wdlinux ~]# wget http://www.wdlinux.cn/in_scripts/vhost.sh.txt
--2011-11-21 00:02:16--  http://www.wdlinux.cn/in_scripts/vhost.sh.txt
Resolving www.wdlinux.cn... failed: Temporary failure in name resolution.
wget: unable to resolve host address `www.wdlinux.cn'

在网上查了下报错,是由于,resolv.conf中的DNS配置错误引起的。。。但是修改后 重启 仍然不能下载

求解。。。

执行
echo "113.105.167.213   www.wdlinux.cn" >> /etc/hosts
再下载
看清提问三步曲及多看教程/FAQ索引(wdcp,v3,一键包,wdOS),益处多多.wdcp工具集 阿里云主机8折优惠码

TOP

回复 2# admin
执行了你所说的但还是下载不成功 这次提示是超时...

    Connecting to www.wdlinux.cn|113.105.167.213|:80... failed: Connection timed out.
Retrying.
--2011-11-21 01:53:52--  (try: 2)  http://www.wdlinux.cn/in_scripts/vhost.sh.txt
Connecting to www.wdlinux.cn|113.105.167.213|:80...

TOP

  1. #!/bin/bash
  2. #
  3. # Web Server Install Script
  4. # Created by wdlinux QQ:12571192
  5. # Url:http://www.wdlinux.cn
  6. # Last Updated 2010.11.19
  7. #


  8. PS_SERVER=`ps ax | grep nginx.conf | grep -v "grep"`
  9. if [[ $PS_SERVER ]];then
  10.         SERVER="nginx"
  11. else
  12.         SERVER="apache"
  13. fi

  14. conf_dir="/www/wdlinux/$SERVER/conf/vhost"
  15. log_dir="/www/wdlinux/$SERVER/logs"
  16. web_dir="/www/web"

  17. function dis_info {
  18.         clear
  19.         echo
  20.         echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
  21.         echo "Add Virtual Host for wdlinux or lanmp,Written by wdlinux"
  22.         echo "---------------------------------------------------------------"
  23.         echo "Wdlinux is a customized version of CentOS based, for quick, easy to install web server system"
  24.         echo "lanmp is a tool to auto-compile & install lamp or lnmp on linux"
  25.         echo "This script is a tool add virtual host for wdlinux"
  26.         echo "For more information please visit http://www.wdlinux.cn"
  27.         echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
  28.         echo
  29.         echo "The server is running $SERVER"
  30.         echo "----------------------------------------------------------------"
  31.         echo
  32. }
  33. dis_info;

  34. echo "Pleast input domain:"
  35. read -p "(Default or Example domain:www.wdlinux.cn):" domain
  36. if [[ $domain == "" ]];then
  37.         domain="www.wdlinux.cn"
  38. fi
  39. echo
  40. echo "domain:$domain"
  41. echo "-----------------------------------------"
  42. echo
  43. sdomain=${domain#www.}
  44. if [[ -f "$conf_dir/$domain.conf" ]];then
  45.         echo "$conf_dir/$domain.conf is exists!"
  46.         exit
  47. fi

  48. echo "Do you want to add more domain name? (y/n)"
  49. read more_domain
  50. if [[ $more_domain == "y" || $more_domain == "Y" ]];then
  51.         echo "Input domain name,example(bbs.wdlinux.cn blog.wdlinux.cn):"
  52.         read domain_a
  53.         domain_alias=${sdomain}" "${domain_a}
  54. else
  55.         domain_alias=$sdomain;
  56. fi
  57. echo
  58. echo "domain alias:$domain_alias"
  59. echo "-----------------------------------------"
  60. echo

  61. echo "Allow access_log? (y/n)"
  62. read access_log
  63. if [[ $access_log == "y" || $access_log == "Y" ]];then
  64.         nginx_log="log_format  $domain  '\$remote_addr - \$remote_user [\$time_local] \"\$request\" '
  65.                '\$status \$body_bytes_sent \"\$http_referer\" '
  66.                '\"\$http_user_agent\" \$http_x_forwarded_for';
  67.             access_log  logs/$domain.log  $domain;"
  68.         apache_log="    ErrorLog \"logs/$domain-error_log\"
  69.     CustomLog \"logs/$domain-access_log\" common"
  70.         echo
  71.         echo "access_log dir:"$log_dir/$domain.log
  72.         echo "------------------------------------------"
  73.         echo
  74. else
  75.         nginx_log="access_log off;"
  76.         apache_log=""
  77. fi

  78. echo "Do you want to add ftp Account? (y/n)"
  79. read ftp_account
  80. if [[ $ftp_account == "y" || $ftp_account == "Y" ]];then
  81.         read -p "ftp user name:" ftp_user
  82.         read -p "ftp user password:" ftp_pass
  83.         useradd -d $web_dir/$domain -s /sbin/nologin $ftp_user
  84.         echo "$ftp_pass" | passwd --stdin $ftp_user
  85.         chmod 755 $web_dir/$domain
  86.         echo
  87. else
  88.         echo "Create virtual host directory."
  89.         mkdir -p $web_dir/$domain
  90.         chown -R www.www $web_dir/$domain
  91. fi

  92. if [[ $SERVER == "nginx" ]];then
  93. cat > $conf_dir/$domain.conf<<eof
  94. server {
  95.         listen       80;
  96.         server_name $domain $domain_alias;
  97.         root $web_dir/$domain;
  98.         index  index.html index.php index.htm wdlinux.html;

  99.         location ~ \.php$ {
  100.             fastcgi_pass   127.0.0.1:9000;
  101.             fastcgi_index  index.php;
  102.             include fcgi.conf;
  103.         }
  104.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
  105.                 expires      1d;
  106.         }

  107.         location ~ .*\.(js|css)?$ {
  108.                 expires      12h;
  109.         }
  110.         $nginx_log
  111.     }
  112. eof
  113. else
  114. cat > $conf_dir/$domain.conf<<eof
  115. <VirtualHost *:80>
  116.     DocumentRoot "$web_dir/$domain"
  117.     ServerName $domain
  118.     ServerAlias $domain_alias
  119. $apache_log
  120. </VirtualHost>
  121. eof
  122. fi

  123. cat > $web_dir/$domain/index.html<<eof
  124. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  125. <html xmlns="http://www.w3.org/1999/xhtml">
  126. <head>
  127. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  128. <title>test page</title>
  129. </head>

  130. <body>
  131. <div align="center">
  132.   <h1>test page of $domain  </h1>
  133.   <p>Create by vhost.sh of <a href="http://www.wdlinux.cn" target="_blank">www.wdlinux.cn</a> </p>
  134. </div>
  135. </body>
  136. </html>
  137. eof
  138. if [[ $ftp_account == "y" || $ftp_account == "Y" ]];then
  139.         chown $ftp_user $web_dir/$domain/index.html
  140. fi

  141. if [[ $SERVER == "nginx" ]];then
  142.         service nginxd restart
  143. else
  144.         service httpd restart
  145. fi

  146. echo
  147. echo
  148. echo
  149. echo "web site infomations:"
  150. echo "========================================"
  151. echo "domain list:$domain $domain_alias"
  152. echo "----------------------------------------"
  153. echo "website dir:$web_dir/$domain"
  154. echo "----------------------------------------"
  155. echo "conf file:$conf_dir/$domain.conf"
  156. echo "----------------------------------------"
  157. if [[ $access_log == "y" || $access_log == "Y" ]];then
  158.         echo "access_log:$log_dir/$domain.log"
  159.         echo "----------------------------------------"
  160. fi
  161. if [[ $ftp_account == "y" || $access_log == "Y" ]];then
  162.         echo "ftp user:$ftp_user password:$ftp_pass";
  163.         echo "----------------------------------------"
  164. fi
  165. echo "web site is OK"
  166. echo "For more information please visit http://www.wdlinux.cn"
  167. echo "========================================"
复制代码

TOP

楼主 我帮你下了http://www.wdlinux.cn/in_scripts/vhost.sh.txt 上面是这个文件的内容

TOP

回复 5# xmmaster


    谢谢这位兄弟~

我知道下载,但是解决不了为什么不能wget。。。

TOP

回复  admin
执行了你所说的但还是下载不成功 这次提示是超时...

    Connecting to ... failed: Conn ...
花少 发表于 2011-11-20 17:53



  这个是网络原因
看清提问三步曲及多看教程/FAQ索引(wdcp,v3,一键包,wdOS),益处多多.wdcp工具集 阿里云主机8折优惠码

TOP

本帖最后由 花少 于 2011-11-23 16:11 编辑

回复 7# admin


    谢谢管理员 的确是网络问题

本机IP 192.168.1.2 虚拟机IP 192.168.110 网关 192.168.1.1

本机和虚拟机可以ping通

但虚拟机ping不通外网 就造成了无法wget

虚拟机怎么才能ping通外网呢?

/etc/resolv.conf 设置的是

202.101.226.68

202.101.224.69

我这本地电信的DNS


但是我在VM上ping www.baidu.com

ping: unknown host www.baidu.com

求解

TOP

首先,你要确定网络通,再确定DNS
如果网络不通,DNS也没有意义
看清提问三步曲及多看教程/FAQ索引(wdcp,v3,一键包,wdOS),益处多多.wdcp工具集 阿里云主机8折优惠码

TOP

回复 9# admin


    我本机网络是通的 可以上网 一切正常

到虚拟机那边就不行

TOP

最后临时解决方法如下:

采用NAT,ping外网的时候一直出现connect: network is unreachable 错误

这条命令就可以搞定 哈哈

route add default  gw 192.168.1.1

后面那是你的网关。

现在 route 一下
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
default         my.router       0.0.0.0         UG    0      0        0 eth0

之前如果没有添加 的话, 只有上面的第一条。  第二条是新加进去的。
如果还访问不了, 哪你的情况可能有点特殊哦。

这样重启以后 就不能 用了。
修改
编辑  /etc/network/interfaces
添加 gateway  192.168.1.1
or
在/etc/sysconfig/network中添加:
GATEWAY=your IP


以上是百度到的,临时的route方法可以,后面的方法试了重启后还是无效。

TOP

回复 1# 花少


    以我使用的VM为例,网卡设置为bridged。也就是桥接模式,虚机网卡与本机网卡设置一致,IP不一样再看看。

TOP

返回列表