使 WAMP www 在本地网络上可用
我知道有类似的问题,但没有一个能解决我的具体情况。
我有一个用于开发一些网站的 WAMP 服务器设置,它运行得很好。我需要它可以通过无线路由器供本地网络上的另一台计算机使用。另一台电脑实际上是Mac,我只需要能够通过浏览器查看开发站点(不需要访问phpmyadmin或mySQL)。
我可以使用我的 Windows 计算机的 IP 通过浏览器访问运行 WAMP 的本地主机(显示默认的 WAMP 页面,其中包含指向站点项目的链接)。显然,单击链接会导致找不到页面,因为 URL 是相对于 localhost 的,但即使我显式输入带有 IP 的 URL (http://192.168.2.1/myproject
) 我还是一无所获。 (即使我如图所示输入,网址也会重定向到 localhost/myproject)
我的主机有一个动态 IP,但由于它硬连线到调制解调器和路由器,因此 IP 不会更改,除非我重置路由器/调制解调器。不过,我看不出这是问题所在,因为我可以使用 Mac 的 IP 访问默认的 WAMP 页面。
有什么想法吗?
I know there are questions similar to this, but none address my specific situation.
I have a WAMP server setup for developing some websites, and it's running great. I need it to be available to another computer on my local network via a wireless router. The other computer is actually a Mac, and I only need to be able to view the development sites through a browser (do not need to access phpmyadmin or mySQL).
I am able to access the localhost on which WAMP is running through the browser (the default WAMP page is displayed with links to the site projects) using the IP of my windows machine. Obviously clicking on the links would result in page not found since the URL is relative to localhost, but even if I explicitly type in the url with the IP (http://192.168.2.1/myproject
) i still get nothing. (and the url redirects to localhost/myproject even if I type it in as shown)
My host machine has a dynamic IP, but since it is hard-wired to the modem and router the IP does not change unless I reset the router/modem. I can't see this being the problem though since I am able to access the default WAMP page using the IP from the Mac.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
默认情况下,
httpd.conf
有以下设置。您必须进行以下更改。
并使WAMP成为在线。
您可以通过网络中的 IP 地址或计算机名称访问您的站点。
By default
httpd.conf
have the following settings.you have to make the below mentioned changes.
and make WAMP as a online.
You can access you site by IP address or Computer name from Network.
我的 WordPress 网站也遇到了同样的问题。我的目标是通过 LAN 上另一个 PC/Linux 工作站的浏览器查看开发网站。以下步骤为我解决了这个问题:
转到 WordPress 设置 >一般> WordPress 地址 (URL) 和站点地址 (URL)
将运行 WAMP 服务器的本地 PC 的本地 IP 地址添加到字段中并保存设置。 (例如http://192.168.0.101/wordpress;在DOS命令窗口中使用ipconfig获取本地主机的IP地址)。
从系统托盘上的 WAMP 服务器菜单“Put Online”。现在,LAN 中的任何其他设备都可以在浏览器上使用 IP 地址 (http://192.168.0.106/wordpress) 查看网站,并且链接现在应该可以工作。
I had the same problem with my Wordpress site. My aim was to see the developmental website from a browser in another PC/Linux Workstation on the LAN. Following steps resolved the issue for me:
Go to WordPress Settings > General > WordPress Address (URL) and Site Address (URL)
Add local IP address of the localhost PC where WAMP server is running to the fields and save the settings. (e.g. http:// 192.168.0.101/wordpress; Use ipconfig in a DOS command window to get IP address of the localhost).
From the WAMP server menu on system tray "Put Online". Now any other devices in the LAN can view the website using the IP address on a browser (http:// 192.168.0.106/wordpress) and the links should be working now.
尝试这些建议。我的建议是检查 Apache 是否仅绑定到 127.0.0.1 (localhost),如果不存在则添加 192.168.2.1 映射。添加后不要忘记重新启动 Apache。
Try these recommendations. My suggestion would be to check if Apache is bind only to 127.0.0.1 (localhost) and add 192.168.2.1 mapping if it is not there. Don't forget to restart Apache after adding it.
如果您在 Windows 上使用 wamp,请将 Windows 防火墙设置更改为关闭模式,然后重新启动服务器并检查。
控制面板-->系统和安全-->Windows 防火墙-->关闭 Windows 防火墙
只需进行上述更改即可看到效果。
干杯
阿米特
If you are using wamp on windows than please change your windows firewall settings to OFF mode and restart your server and check.
Control Panel-->System and Security-->Windows Firewall-->Turn off windows Firewall
Just make the above change and see this will work.
cheers
Amit
现在我已经弄清楚了,这是有道理的。
重定向到 localhost 实际上是由构建站点的 CMS 的配置文件引起的(因此它会显示主 WAMP 页面,但无法加载项目站点)。
Makes sense now that I have figured it out.
The redirect to localhost was actually caused by the configuration file for the CMS that the site was built on (thus why it would bring up the main WAMP page, but not be able to load the project site).
首先,将您的 wamp 放到仪表板上。稍后,如果
httpd.conf
文件中有一个设置Listen 80
(如果与此不同)。将其更改为
Listen 80
,然后禁用防火墙并重新启动 Wamp 所有服务。First of all put online your wamp on your dashboard. Later on if there is a setting in
httpd.conf
fileListen 80
if this is different than that.Change it to
Listen 80
then disable your firewall restart Wamp all services.首先,将您的 wamp 放到仪表板上。然后关闭防火墙稍后,如果
httpd.conf
文件中有一个设置Listen 127.0.0.80
(如果这与此不同)。将其更改为 Listen 127.0.0.80 以
允许所有
重新启动 Wamp 所有服务。First of all put online your wamp on your dashboard. And then put off your firewall Later on if there is a setting in
httpd.conf
fileListen 127.0.0.80
if this is different than that.Change it to Listen 127.0.0.80 to
Allow for all
restart Wamp all services.您可以尝试将服务器的主机名添加到 Mac 上的主机文件中。然后您将使用有效的主机名访问 HTTP 服务器。
You could try adding the hostname of the server to the hosts file on the Mac. Then you're hitting the HTTP server using a valid hostname.
我认为您使用了错误的 IP 地址,因为大多数路由器本身使用 192.168.1.1。
这就是为什么您无法查看任何内容,即您的计算机具有不同的 IP 地址。
要解决这个问题,首先你需要知道你的计算机的IP地址
我窗
转到命令
并输入 ipconfig
在那里您可以看到您的计算机的 IPv4 局域网 IP 地址
使用此 IP 地址连接到 wamp 服务器。
希望这对您有帮助
I think you are using wrong ip address as most of router uses 192.168.1.1 for itself.
Thats why you are not able to view anything i.e your computer has different ip address.
To solve it, first you need to know ip address of your ow computer
I window
go to cmd
and type ipconfig
there you can see your computer lan ip address in IPv4
Use this ipaddress to connect to wamp server.
Hope this help you