a.com 和 b.com都指向了b.com的根目录(系统重启过N次)。以下是配置过程。麻烦各位看看哪里配置有错误。谢谢
hosts文件
127.0.0.1 a.com
127.0.0.1 b.com
127.0.0.1 http://www.a.com
127.0.0.1 http://www.b.com
apache配置
复制/etc/apache2/sites-available/default为a和b两个文件
a配置内容并且关联文件sudo ln -s /etc/apache2/sites-available/a /etc/apache2/sites-enabled/a
<VirtualHost *:80>
ServerAdmin http://www.a.com
DocumentRoot /home/nick/workspace/www/a
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/nick/workspace/www/a/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
b配置内容并且关联文件sudo ln -s /etc/apache2/sites-available/b /etc/apache2/sites-enabled/b
<VirtualHost *:80>
ServerAdmin http://www.b.com
DocumentRoot /home/nick/workspace/www/b
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/nick/workspace/www/b/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
apache虚拟主机2个域名都指向了同一目录
-
- 帖子: 12
- 注册时间: 2009-05-13 0:40
- mjp123
- 帖子: 702
- 注册时间: 2009-04-09 15:06
-
- 帖子: 12
- 注册时间: 2009-05-13 0:40
- jarlyyn
- 帖子: 4671
- 注册时间: 2006-04-12 18:54
- 联系:
-
- 帖子: 12
- 注册时间: 2009-05-13 0:40
Re: apache虚拟主机2个域名都指向了同一目录
你指的是楼上那种吗?jarlyyn 写了:一个ip和端口多个站点是靠servername的
-
- 帖子: 12
- 注册时间: 2009-05-13 0:40
Re: apache虚拟主机2个域名都指向了同一目录
感谢楼上的朋友回答,配置成功