如何允许远程访问我的 WAMP 服务器(用于移动设备(Android))

2021-12-20 00:00:00 networking wamp wireless php

我使用 PHP 和 jQuery 创建了一个移动网站.它适用于我的 PC,但现在我想用我的 Android 设备测试它.我该怎么做?

I have created a website for mobile using PHP and jQuery. It works on my PC but now I want to test it with my Android device. How can I do that?

如何从我的 Android 设备访问 WAMP 服务器的 IP?

How can I access a WAMP server's IP from my Android device?

我的手机和 PC 连接在同一路由器内.我应该直接连接到我的 PC 还是通过路由器连接?

My mobile and PC are connected within the same router. Should I directly connect to my PC or can I do that through the router?

我已经搜索过它,发现我必须在 phpmyadmin.conf 中更改权限,但它仍然不起作用.任何想法为什么它不起作用?

I have searched about it and found that I have to change permissions in phpmyadmin.conf but still it does not work. Any ideas why doesn't it work?

我的 httpd.config 有这样的东西.

My httpd.config has something like this.

<Directory />
    Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 192.168.0.104
</Directory>

192.168.0.104 是我的安卓设备的 IP.

192.168.0.104 is my android device's IP.

推荐答案

我假设您使用的是 Windows.打开命令提示符并输入 ipconfig 并找出您的本地地址(在您的电脑上)它应该类似于 192.168.1.13192.168.0.5> 其中末尾数字是更改的数字.它应该在 IPv4 地址旁边.

I assume you are using windows. Open the command prompt and type ipconfig and find out your local address (on your pc) it should look something like 192.168.1.13 or 192.168.0.5 where the end digit is the one that changes. It should be next to IPv4 Address.

如果您的 WAMP 不使用虚拟主机,下一步是在您的手机浏览器中输入该 IP 地址,即 http://192.168.1.13 如果您有虚拟主机,则需要 root编辑主机文件.

If your WAMP does not use virtual hosts the next step is to enter that IP address on your phones browser ie http://192.168.1.13 If you have a virtual host then you will need root to edit the hosts file.

如果您想测试网站的响应能力/移动设计,您可以在 Chrome 或其他浏览器中更改用户代理以模拟移动设备.

If you want to test the responsiveness / mobile design of your website you can change your user agent in chrome or other browsers to mimic a mobile.

参见 http://googlesystem.blogspot.co.uk/2011/12/changed-user-agent-new-google-chrome.html.

Chrome 开发工具现在有一个移动调试工具,您可以在其中更改视口的大小、欺骗用户代理、连接(4G、3G 等).

Chrome dev tools now has a mobile debug tool where you can change the size of the viewport, spoof user agents, connections (4G, 3G etc).

如果您被禁止访问,请查看此问题 WAMP 错误:禁止您无权访问此服务器上的/phpmyadmin/.基本上,将httpd.conf 文件中deny,allow 的出现更改为allow,deny.您可以通过 WAMP 菜单访问它.

If you get forbidden access then see this question WAMP error: Forbidden You don't have permission to access /phpmyadmin/ on this server. Basically, change the occurrances of deny,allow to allow,deny in the httpd.conf file. You can access this by the WAMP menu.

要暂时消除问题的可能原因,请将您的配置文件设置为

To eliminate possible causes of the issue for now set your config file to

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    <RequireAll>
        Require all granted
    </RequireAll>
</Directory>

因为这适用于我的 Windows PC,如果您也有目录配置块,请将其更改为允许所有.

As thatis working for my windows PC, if you have the directory config block as well change that also to allow all.

解决问题的配置文件:

https://gist.github.com/samvaughton/6790739

问题是/www apache 目录配置块仍然将拒绝设置为默认值,并且只允许来自本地主机.

Problem was that the /www apache directory config block still had deny set as default and only allowed from localhost.

相关文章