【发布时间】:2012-03-27 07:34:00
【问题描述】:
所以我有这个问题......
我过去使用 WAMP 并设置了完美运行的虚拟主机,但现在我遇到了我从未预见到的事情。
我正在尝试这样做:
通过http://localhost访问C:\wamp\www
通过http://localhost:8080 或http://something.dev 访问 D:\somethingelse
我更喜欢使用正确的http://something.dev,因为工作站点是http://something.co,所以我可以将它们分开。
我已经按照指南阅读了论坛帖子,但到目前为止我所做的只是:
通过http://localhost或http://something.dev访问C:\wamp\www
通过http://localhost:8080 或http://something.dev:8080 访问 D:\somethingelse
有人知道你会怎么做吗?这是我的虚拟主机代码:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "C:\wamp\www"
ServerName localhost
ServerAlias www.localhost.com
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
<VirtualHost *:8080>
ServerAdmin webmaster@something
DocumentRoot "D:/something/www"
ServerName something.dev
ServerAlias www.something.dev
ErrorLog "logs/something-error.log"
CustomLog "logs/something-access.log" common
<directory "D:/something/www">
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
</directory>
</VirtualHost>
在 httpd.conf 我有这个
Listen *:80
Listen *:8080
我的主机文件正在工作,并将这两个文件都指向 127.0.0.1
(我想这样做的原因是,当我在我的机器上编码时,我使用http://something.dev,但我运行 Livereload Windows,并在同一本地网络上的 iPhone 和 iPad 上同时测试我的网站,但没有任何对 iOS 等效主机文件的访问。它还允许我通过路由器上的端口转发仅将服务器的特定部分打开到互联网。)
【问题讨论】:
标签: apache wamp virtualhost