我的工作就是让wamp工作!
我已经在我的win7 64位机器上安装了wampserver2.5。
在httdp.conf文件中,我刚刚注释掉了关于vhosts的行:
Include conf/extra/httpd-vhosts.confhttpd-vhosts.conf包含:
<VirtualHost *:80>
DocumentRoot "C:/Users/Alain/Dropbox/Website/exemples/Grafikart/Petsy_alain.dev"
ServerName petsy.dev
ServerAlias www.petsy.dev
<Directory "C:/Users/Alain/Dropbox/Website/exemples/Grafikart/Petsy_alain.dev">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
<RequireAny>
Require local
Require ip 192.168.1
</RequireAny>
</Directory>
</VirtualHost>(我也试过要求所有人都同意)
我首先安装了wampserver2.564位。
我可以从我的本地机器访问http://petsy.dev,但当我尝试从局域网的另一台机器访问http://192.168.1.16/petsy.dev时,我总是收到403错误(禁止):
[Thu Dec 04 14:43:08.519329 2014] [authz_core:error] [pid 11088:tid 776] [client 192.168.1.15:39975] AH01630: client denied by server configuration: C:/Users/Alain/Dropbox/Website/exemples/Grafikart/Petsy_alain.dev
[Thu Dec 04 14:43:08.635335 2014] [authz_core:error] [pid 11088:tid 776] [client 192.168.1.15:39975] AH01630: client denied by server configuration: C:/wamp/www/favicon.ico当我在远程PC hosts文件中添加以下行时,我可以远程访问petsy.dev:
192.168.1.16 petsy.dev在这种情况下,我能够在我的远程机器上使用'http://petsy.dev‘访问服务器。
首先,我不明白它在服务器端改变了什么,其次,我对这个解决方案不满意,因为我不能在智能手机上使用它。
由于我在任何地方都找不到答案,我最终尝试安装wampserver2.532位!
同样的问题!但有不同的错误:
我总是可以在本地访问我的petsy.dev网站,但是现在,当我尝试远程访问它时,我得到了一个404错误(找不到)!
以下是我本地机器上apache的访问日志:
xxxx::7d1a:xxxx:9672:xxxx - - [05/Dec/2014:19:22:25 +0100] "GET / HTTP/1.1" 200 40438在我的远程机器上:
192.168.1.15 - - [05/Dec/2014:19:22:30 +0100] "GET /petsy.dev/ HTTP/1.1" 404 295httpd -T answers语法正常
httpd -S说:
VirtualHost configuration:
*:80 is a NameVirtualHost
default server localhost (C:/wamp/bin/apache/apache2.4.9/conf/extra/httpd-vhosts.conf:23)
port 80 namevhost localhost (C:/wamp/bin/apache/apache2.4.9/conf/extra/httpd-vhosts.conf:23)
alias localhost
port 80 namevhost petsy.dev (C:/wamp/bin/apache/apache2.4.9/conf/extra/httpd-vhosts.conf:34)
alias www.petsy.dev
ServerRoot: "C:/wamp/bin/apache/apache2.4.9"
Main DocumentRoot: "C:/wamp/www/"
Main ErrorLog: "C:/wamp/logs/apache_error.log"
Mutex rewrite-map: using_defaults
Mutex authdigest-client: using_defaults
Mutex default: dir="C:/wamp/bin/apache/apache2.4.9/logs/" mechanism=default
Mutex authdigest-opaque: using_defaults
PidFile: "C:/wamp/bin/apache/apache2.4.9/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Define: APACHE24=Apache2.4求求你,求求你我犯了什么愚蠢的错误?
发布于 2014-12-06 08:23:19
你不需要<RequireAny>,所以你可以试试这个
<VirtualHost *:80>
DocumentRoot "C:/Users/Alain/Dropbox/Website/exemples/Grafikart/Petsy_alain.dev"
ServerName petsy.dev
ServerAlias www.petsy.dev
<Directory "C:/Users/Alain/Dropbox/Website/exemples/Grafikart/Petsy_alain.dev">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
Require ip 192.168.1
</Directory>
</VirtualHost>附加信息我认为您不了解创建虚拟主机时发生的事情。
基本上,当Apache看到它配置了一个或多个虚拟主机时,您就是在通知Apache它是多个域名的服务器。
然后,它会将域名与其虚拟主机定义之一进行匹配,并将DocumentRoot和其他参数更改为在该虚拟主机中设置的参数。
因此,重要的是,您要在另一台PC的浏览器中使用匹配的域名,以便使用它所知道的域名访问Apache。
这通常是由真实互联网上的DNS服务器完成的,但当您在自己的本地网络中时,即安全地在路由器后面,您必须使用另一种方法。您可以设置自己的本地DNS服务器,但这是相当复杂的。
因此,简单的解决方案是使用网络中其他PC上的HOSTS文件。
因此,在另一台PC (不是运行WAMPServer的PC )上,编辑\windows\system32\drivers\etc\hosts文件并添加以下内容
192.168.1.16 petsy.dev使用“以管理员身份运行”启动一个命令窗口,然后执行这两个命令来重新加载缓存
net stop dnscache
net start dnscache现在您可以在非wampserver pc上的浏览器中使用正确的域名,如下所示
http://petsy.dev当与192.168.1.16建立连接时,它将使用corretc域名,即petsy.dev,apache将找到虚拟主机,并根据VH配置和正确文件夹中的服务器页面设置所有内容。
发布于 2015-01-29 11:01:16
这里有一个很棒的教程
Project Links do not work on Wamp Server
答案#1适用于我
我运行的是64位windows 7
我在分配给字母A的硬盘上安装了wampserver2.5 (64位)
我的所有开发站点都位于A:\websites
在A:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf中,我有这样的功能
<VirtualHost *:80>
DocumentRoot "A:/websites"
ServerName localhost
ServerAlias localhost
<Directory "A:/websites">
AllowOverride All
Require local
</Directory>
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost.log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "A:/websites/example.dev/www
ServerName example.dev
ServerAlias www.example.dev
<Directory "A:/websites/example.dev/www>
AllowOverride All
Require local
Require ip 192.168.10
</Directory>
</VirtualHost>在运行wamp的计算机上,我调整了主机文件,如下所示
127.0.0.1 example.dev
::1 example.dev
在本地远程计算机上,我在主机文件中添加了一个条目,如下所示
192.168.10.100 example.dev (这是运行wamp的计算机的ip地址)
下一步是清除dns缓存
在windows box上打开一个不是web服务器的终端
键入"net stop dnscache“
键入"net start dnscache“
打开浏览器并将其指向example.dev,即可正常工作
希望这能有所帮助
https://stackoverflow.com/questions/27322656
复制相似问题