无法从其他计算机访问网页

时间:2018-05-19 22:14:21

标签: apache httpd.conf

我是httpd中的新手,我的问题是我无法从其他计算机访问我的网页。

我要做的是使用以下https://www.youtube.com/watch?v=1ZioHruINOA部署最小的httpd.conf文件。

/etc/httpd/conf/httpd.conf是

Listen 0.0.0.0:80
User apache
Group apache
ServerName www.example.com
ErrorLog /var/log/httpd/error.log
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule dir_module modules/mod_dir.so
DirectoryIndex index.html
DocumentRoot /var/www/html
<Directory /var/www/html>
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>

运行命令后

sudo apachectl start
w3m 172.31.30.53

我可以看到所需的网页(/var/www/html/index.html)

但是,运行命令

w3m 172.31.30.53

在其他计算机的终端上无效。

提前谢谢。

  

EDIT1:

sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
Apache Full                ALLOW       Anywhere
22                         ALLOW       Anywhere
80                         ALLOW       Anywhere
Anywhere                   ALLOW       0.0.0.0
Apache Full (v6)           ALLOW       Anywhere (v6)
22 (v6)                    ALLOW       Anywhere (v6)
80 (v6)                    ALLOW       Anywhere (v6)
  

EDIT2:

/etc/apache2$ nmap 127.0.0.1

Starting Nmap 6.40 ( http://nmap.org ) at 2018-05-20 21:31 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00019s latency).
Not shown: 998 closed ports
PORT   STATE SERVICE
22/tcp open  ssh
80/tcp open  http

Nmap done: 1 IP address (1 host up) scanned in 0.91 seconds

1 个答案:

答案 0 :(得分:1)

听起来你正试图在Linux机器上运行你的网络服务器。如果要从其他计算机访问网页,可能需要检查防火墙设置。在本地访问应该有效,但根据您的发行版,您必须允许访问。在Ubuntu上,您必须检查ufw

编辑1:

从其他计算机上试用nmap。这样您就可以看到可用的端口。示例:nmap yourmachine

相关问题