Apache 无法从远程计算机访问wampserver 2.5
我不想让wamp工作 我已经在我的win7 64位机器上安装了wampserver 2.5 在httdp.conf文件中,我刚刚注释掉了关于vhost的行:Apache 无法从远程计算机访问wampserver 2.5,apache,wampserver,Apache,Wampserver,我不想让wamp工作 我已经在我的win7 64位机器上安装了wampserver 2.5 在httdp.conf文件中,我刚刚注释掉了关于vhost的行: Include conf/extra/httpd-vhosts.conf httpd-vhosts.conf包含: <VirtualHost *:80> DocumentRoot "C:/Users/Alain/Dropbox/Website/exemples/Grafikart/Petsy_alain.dev"
Include conf/extra/httpd-vhosts.conf
httpd-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>
在远程PC主机文件中添加以下行时,我远程访问了petsy.dev:
192.168.1.16 petsy.dev
在这种情况下,我能够在我的远程机器上使用访问服务器
首先,我不明白它在服务器端改变了什么,其次,我不能满足于这个解决方案,因为我不能在智能手机上使用它
由于我在任何地方都找不到答案,我最终尝试安装wampserver 2.5 32位
同样的问题!但有一个不同的错误:
我总是可以在本地访问我的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 295
httpd-T回答语法正常
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
求求你,求求你,我犯了哪个愚蠢的错误???你不需要这个,所以试试这个
<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>
然后重新启动或执行此操作以重新加载windows dnscache
使用“以管理员身份运行”启动windows命令,并执行这两个命令以重新加载缓存
net stop dnscache
net start dnscache
现在,您可以在非wampserver pc上的浏览器中使用正确的域名,如下所示
http://petsy.dev
浏览器会发现petsy.dev的ip地址为192.168.1.16。当连接到192.168.1.16时,它将使用correct域名,即petsy.dev和apache将找到虚拟主机,并根据VH配置和服务器页面从正确的文件夹中设置所有内容。这是一个很好的教程
答案1对我有用
我正在运行64位windows 7
我已经在分配给字母a的hd上安装了wampserver2.5 64位
我的所有开发网站都位于以下网站上:
在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机箱上打开一个不是web服务器的终端
类型净止动器dnscache
输入净启动dnscache
打开一个浏览器并将其指向example.dev,它就可以工作了
希望这有帮助Hi RiggsFolly,我试过了,我想我不幸尝试了所有方法,但如果使用wamp id地址(如http://192.168.1.16/petsy.dev)进行远程访问,我真的无法让wampserver 2.5工作,或者我不知道还有什么。。。
http://petsy.dev
<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>