【问题标题】:How to make Android phone's firefox open my wordpress on pc?如何让安卓手机的火狐在电脑上打开我的wordpress?
【发布时间】:2019-11-09 11:36:56
【问题描述】:

环境:debian9 + apache2。

ifconfig
enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.31.52  netmask 255.255.255.0  broadcast 192.168.31.255

apache2 的设置。

sudo cat  /etc/apache2/sites-enabled/000-default.con
<VirtualHost 192.168.31.52:80>
DocumentRoot  /home/content/mydoc
</VirtualHost>  

<VirtualHost *:80>
ServerName localhost
DocumentRoot /home/content/mydoc
<FilesMatch "\.(html|htm|js|css|json)$">
    FileETag None

    <IfModule mod_headers.c>
      Header unset ETag
      Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
      Header set Pragma "no-cache"
      Header set Note "CACHING IS DISABLED ON LOCALHOST"
      Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
    </IfModule>
</FilesMatch>


Alias   /wp  "/var/www/html/wp"
<Directory /var/www/html>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
</VirtualHost>

当在我本地电脑的 Firefox 中输入127.0.0.1 时,/home/content/mydoc 中的所有网页都会显示。 什么时候在我本地电脑的firefox中输入127.0.0.1/wp/var/www/html/wp中的所有网页都会显示出来。 什么时候在我本地电脑的firefox中输入192.168.31.52/home/content/mydoc中的所有网页都会显示出来。
什么时候在我本地电脑的firefox中输入192.168.31.52/wp/var/www/html/wp中的所有网页都会显示。 现在我想用我的android手机打开/home/content/mydoc的网页,输入http://192.168.31.52,为什么我的android手机的firefox无法连接到pc中的apache2服务器?

sudo iptables -L -v
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
 7204 7355K ACCEPT     all  --  any    any     anywhere             anywhere             ctstate RELATED,ESTABLISHED
   44  2578 ACCEPT     all  --  lo     any     anywhere             anywhere            
   16  1638 INPUT_direct  all  --  any    any     anywhere             anywhere            
   16  1638 INPUT_ZONES_SOURCE  all  --  any    any     anywhere             anywhere            
   16  1638 INPUT_ZONES  all  --  any    any     anywhere             anywhere            
    0     0 DROP       all  --  any    any     anywhere             anywhere             ctstate INVALID
   16  1638 REJECT     all  --  any    any     anywhere             anywhere             reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     all  --  any    any     anywhere             anywhere             ctstate RELATED,ESTABLISHED
    0     0 ACCEPT     all  --  lo     any     anywhere             anywhere            
    0     0 FORWARD_direct  all  --  any    any     anywhere             anywhere            
    0     0 FORWARD_IN_ZONES_SOURCE  all  --  any    any     anywhere             anywhere            
    0     0 FORWARD_IN_ZONES  all  --  any    any     anywhere             anywhere            
    0     0 FORWARD_OUT_ZONES_SOURCE  all  --  any    any     anywhere             anywhere            
    0     0 FORWARD_OUT_ZONES  all  --  any    any     anywhere             anywhere            
    0     0 DROP       all  --  any    any     anywhere             anywhere             ctstate INVALID
    0     0 REJECT     all  --  any    any     anywhere             anywhere             reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT 6411 packets, 1521K bytes)
 pkts bytes target     prot opt in     out     source               destination         
 6419 1521K OUTPUT_direct  all  --  any    any     anywhere             anywhere            

Chain FORWARD_IN_ZONES (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 FWDI_public  all  --  +      any     anywhere             anywhere            [goto] 

Chain FORWARD_IN_ZONES_SOURCE (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD_OUT_ZONES (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 FWDO_public  all  --  any    +       anywhere             anywhere            [goto] 

Chain FORWARD_OUT_ZONES_SOURCE (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD_direct (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain FWDI_public (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 FWDI_public_log  all  --  any    any     anywhere             anywhere            
    0     0 FWDI_public_deny  all  --  any    any     anywhere             anywhere            
    0     0 FWDI_public_allow  all  --  any    any     anywhere             anywhere            
    0     0 ACCEPT     icmp --  any    any     anywhere             anywhere            

Chain FWDI_public_allow (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain FWDI_public_deny (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain FWDI_public_log (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain FWDO_public (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 FWDO_public_log  all  --  any    any     anywhere             anywhere            
    0     0 FWDO_public_deny  all  --  any    any     anywhere             anywhere            
    0     0 FWDO_public_allow  all  --  any    any     anywhere             anywhere            

Chain FWDO_public_allow (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain FWDO_public_deny (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain FWDO_public_log (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain INPUT_ZONES (1 references)
 pkts bytes target     prot opt in     out     source               destination         
   16  1638 IN_public  all  --  +      any     anywhere             anywhere            [goto] 

Chain INPUT_ZONES_SOURCE (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain INPUT_direct (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain IN_public (1 references)
 pkts bytes target     prot opt in     out     source               destination         
   16  1638 IN_public_log  all  --  any    any     anywhere             anywhere            
   16  1638 IN_public_deny  all  --  any    any     anywhere             anywhere            
   16  1638 IN_public_allow  all  --  any    any     anywhere             anywhere            
    0     0 ACCEPT     icmp --  any    any     anywhere             anywhere            

Chain IN_public_allow (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere             tcp dpt:ssh ctstate NEW

Chain IN_public_deny (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain IN_public_log (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT_direct (1 references)
 pkts bytes target     prot opt in     out     source               destination 

【问题讨论】:

  • 你是通过WIFI还是手机连接的?

标签: android apache firefox debian


【解决方案1】:
sudo cat  /etc/apache2/sites-enabled/000-default.conf
<VirtualHost 192.168.31.52:80>
DocumentRoot  /home/content/mydoc
<Directory /home/content/mydoc>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
</VirtualHost>  

<VirtualHost *:80>
ServerName localhost
DocumentRoot /home/content/mydoc
<FilesMatch "\.(html|htm|js|css|json)$">
    FileETag None

    <IfModule mod_headers.c>
      Header unset ETag
      Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
      Header set Pragma "no-cache"
      Header set Note "CACHING IS DISABLED ON LOCALHOST"
      Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
    </IfModule>
</FilesMatch>


Alias   /wp  "/var/www/html/wp"
<Directory /var/www/html>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
</VirtualHost>

【讨论】:

    【解决方案2】:

    假设 httpd 已启动并监听每个接口,并且 Android 设备在同一网络上,可能的原因是防火墙阻止了连接,使用:

    iptables -L -v
    

    列出过滤规则。

    您可以(临时)添加规则以允许连接到 http 端口:

    iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT
    

    如果它确实解决了问题,您将必须找到如何配置防火墙以使更改更持久。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-02-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多