我有这个配置,但是url app.test.com和stage.test.com都重定向到相同的代码/部署
<VirtualHost *:80>
ServerName app.test.com
DocumentRoot /var/www/html/Test-Prod/web
<Directory "/var/www/html/Test-Prod/web">
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
ErrorLog logs/test-prod__error_log
CustomLog logs/test-prod_access_log common
</VirtualHost>
<VirtualHost *:80>
ServerName stage.test.com
DocumentRoot /var/www/html/Test/web
<Directory "/var/www/html/Test/web">
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
ErrorLog logs/test-website_error_log
CustomLog logs/test-website_access_log common
</VirtualHost>发布于 2014-01-30 01:57:36
如果您仍然使用httpd 2.2,通常的错误是忽略了NameVirtualHost指令。
在您的配置文件中添加以下内容,它可能会工作
NameVirtualHost *.80您可能需要阅读基于命名的基于httpd 2.2的虚拟主机支持的文档。
发布于 2015-04-14 14:12:46
NameVirtualHost *.80
<VirtualHost localhost:80>
ServerName color
ServerAlias localhost
ServerPath "C:/wamp/www/subwww/color"
DocumentRoot "C:/wamp/www"
<Directory "C:/wamp/www/subwww/color">
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>在上面的代码中,子域名是颜色。
如果操作系统是windows,则在“C:/windows/ system 32/dirvers/etc/ color.localhost”中添加"127.0.0.1“,并以记事本作为管理运行。
https://stackoverflow.com/questions/21446387
复制相似问题