2016-05-14 117 views
0

我在使这项工作有点麻烦。现在,DNS正在为我的域名进行传播,所以我刚刚使用常规IP地址,如果这有所作为。在Apache 2虚拟主机上指向子域的问题?

在我/etc/hosts文件我有以下...

ff02::1   ip6-allnodes 
ff02::2   ip6-allrouters 

127.0.0.1 localhost.localdomain localhost 
# Auto-generated hostname. Please do not remove this comment. 
111.111.111.11 main.mydomain.com main 
111.111.111.11 git.mydomain.com 
::1    localhost ip6-localhost ip6-loopback 

我只添加一行到此文件,该行是111.111.111.11 git.mydomain.com。剩下的就在那里,当我得到这个VPS。

我也创造了这个Apache的配置文件git.conf并把它添加到/etc/apache2/sites-available/ ...

<VirtualHost *:80> 
     ServerName git.localhost 
     ServerAdmin [email protected] 
     DocumentRoot /home/allen/Sites/Git 
     ErrorLog ${APACHE_LOG_DIR}/error.log 
     CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost> 

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet 

这是一个简单的Apache默认使用000-default.conf文件的副本,与评论取出,并用一些信息改变了。

我运行命令sudo a2ensite git.conf以及重新启动Apache服务器。

这里的目标是当子域为git时,为具有用于管理Git存储库的Web客户端的虚拟主机提供服务。

我在配置文件中犯了什么错误吗?为了实现此功能,我是否缺少一个步骤?

回答