如何绑定多域名

七 22nd, 2013
Untitled Blog Post Name       使用linode差不多也有2个多月,一直都是用来搭一个blog和VPN翻墙,感觉有点浪费。所以最近就把之前的一个toptesting.net的域名翻出来,打算再弄一个bbs。(toptesting.net这个域名是在新网上注册的,以前没怎么使用)
     下载discuz x3的安装,并通过scp命令上传到linode上之后,就按照linode的一个帮助去添加该站点的信息.
新建一个文件:File:/etc/apache2/sites-available/toptesting.net
<VirtualHost*:80]]>     
       ServerAdminwebmaster@example.org     
       ServerName toptesting.net     
       ServerAlias www.toptesting.net     
       DocumentRoot   /srv/www/toptesting.net/public_html/    
       ErrorLog       /srv/www/toptesting.net/logs/error.log       
       CustomLog   /srv/www/toptesting.net/logs/access.log combined
</VirtualHost>

准备好这个VirtualHost之后,就可以通过命令a2ensite toptesting.net,将sites-available与site-enable目录联系起来。重启apache,使其生效。

service apache2 reload

————-
按道理 ,执行到这个地方,基本上就可以新增加这个域名,但实际上不是这样子的,有几点事情还是需要注意下。
1. 如果执行了上面的操作,导致之前的网站也打不开,说明apache服务出现了问题或者是virtualHost配置问题:
    执行apachectl -S     

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost
default server toptesting.net (/etc/apache2/sites-enabled/toptesting.net:1)
port 80 namevhost toptesting.net (/etc/apache2/sites-enabled/toptesting.net:1)
port 80 namevhost www.wangyuxiong.com (/etc/apache2/sites-enabled/wangyuxiong.com:1)
Syntax OK

 显示正常
执行命令: /etc/init.d/apache2 restart

root@metaboy:~# /etc/init.d/apache2 restart
* Restarting web server apache2 Action ‘start’ failed.
The Apache error log may have more information.
[fail]

说明apache没有启动,这个时候去查看错误的日志即可发现问题。

root@metaboy:~# tail -20 /var/log/apache2/error.log
[Sun Jul 28 06:33:17 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.6 with Suhosin-Patch configured — resuming normal operations
[Mon Jul 29 22:47:15 2013] [notice] Graceful restart requested, doing restart
(2)No such file or directory: apache2: could not open error log file /srv/www/toptesting.net/logs/error.log.
Unable to open logs
[Mon Jul 29 23:04:57 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.6 with Suhosin-Patch configured — resuming normal operations
[Tue Jul 30 10:42:55 2013] [notice] Graceful restart requested, doing restart
(2)No such file or directory: apache2: could not open error log file /srv/www/toptesting.net/logs/error.log.
Unable to open logs
[Tue Jul 30 10:48:29 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.6 with Suhosin-Patch configured — resuming normal operations
[Tue Jul 30 16:33:20 2013] [notice] Graceful restart requested, doing restart
(2)No such file or directory: apache2: could not open error log file /srv/www/toptesting.net/logs/error.log.
Unable to open logs
(2)No such file or directory: apache2: could not open error log file /srv/www/toptesting.net/logs/error.log.
Unable to open logs

基本上问题已经定位出来了,是logs文件夹没有创建,导致服务启动不了,去对应的目录下新建该文件夹即可。
2. 在一般情况下,只要服务启动了,是不会影响到之前的blog站点。目前需要关注的就是新增站点的情况,toptesting还是无法打开。这个是通过Linode的技术人员提供的信息解决的。
Hello,
toptesting.net is using the name servers ns1.dns-ez.com and ns2.dns-ez.com, but these name servers are reporting that they have no zone data for this domain. You will need to create a zone for toptesting.net at this service, with A records pointing to your Linode IP, or change your name servers to use the Linode DNS Manager, and then create A records in the Linode Manager pointing to your Linode IP.

这个域名是在新网上申请的,查看DNS的一些设置,发现当前的确使用的name servers 是 ns1.dns-ez.com and ns2.dns-ez.com,这些应该使新网默认的配置,根据上面的解决方案,我将这些name server全部修改成Linode提供的,如下:

最后进入到Linode的后台,在DNS Manager里面新增一个Domain Zone,创建A records并指向Linode IP。

通过上面的几个操作,现在toptesting论坛已搭建成功了。欢迎大家访问该论坛,www.toptesting.net
~~EOF~~




除非注明,本站文章均为原创。本文基于 BY-NC-SA 协议进行授权,欢迎转载,演绎或用于商业目的,但是必须保留本文的署名 metaboy(包含链接).

本文链接地址: http://blog.wangyuxiong.com/archives/52035

订阅本站:http://www.wangyuxiong.com/feed

分类: 技术尝新         标签: ,
  1. 雅荷之家
    十 29th, 201304:10

    感觉太深奥了、看不懂,,,

无觅相关文章插件,快速提升流量