简体   繁体   English

使用公共 ip 地址访问我的 ubuntu 服务器

[英]Access to my ubuntu server with a public ip address

I have a problem with my raspberry pi 4 model B 4Go I have installed Ubuntu Server 21.10 And installed apache2 And I have a basic ssh access I can access it (ssh and web) with its local ip (192.168.1.90) However impossible to connect or to load a web page with its public ip address, firewall of my pc all closed. I have a problem with my raspberry pi 4 model B 4Go I have installed Ubuntu Server 21.10 And installed apache2 And I have a basic ssh access I can access it (ssh and web) with its local ip (192.168.1.90) However impossible to connect或加载带有公共 ip 地址的 web 页面,我的电脑的防火墙全部关闭。 I don't understand the problem because before on my computer with Wamp installed, lowering the firewall and loading an apache page with a public ip was totally possible (by retesting just now it works without any problem) I also opened port 80 on my box for testing and still nothing我不明白这个问题,因为之前在我安装了 Wamp 的计算机上,降低防火墙并加载带有公共 ip 的 apache 页面是完全可能的(通过重新测试它现在可以正常工作)我还在我的盒子上打开了端口 80进行测试,仍然没有

Is there anything else to configure on my box or directly on my server?在我的盒子上或直接在我的服务器上还有什么要配置的吗? Thanks谢谢

<Directory />
      Options FollowSymLinks
      AllowOverride None
      Require all denied
</Directory>

<Directory /usr/share>
      AllowOverride None
      Require all granted
</Directory>

<Directory /var/www/>
      Options Indexes FollowSymLinks
      AllowOverride None
      Require all granted
</Directory>

#<Directory /srv/>
#     Options Indexes FollowSymLinks
#     AllowOverride None
#     Require all granted
#</Directory>

Here the part of the content in etc/apache/apache2.conf but I don't think it's that since I can't connect anywhere with this ip这里是 etc/apache/apache2.conf 中的部分内容,但我不认为是这样,因为我无法在任何地方连接这个 ip

The apache configuration is correct. apache 配置正确。 Can you check and upload the /var/log/apache2/error.log file of apache to check what is the error?你能检查并上传apache的/var/log/apache2/error.log文件来检查错误是什么吗? Run the tail -f command on the log and refresh the web by accessing the public IP.对日志执行tail -f命令,通过访问公共IP刷新web。

It is possible that your router is blocking the traffic.您的路由器可能会阻止流量。 Have you opened the ports?你打开端口了吗?

I managed to complete my problem thanks to the "port forwarding" option on my box and not the firewall, it is enough to redirect the ports 80 to its local ip, I did not know at all that this option existed.由于我的盒子上的“端口转发”选项而不是防火墙,我设法完成了我的问题,将端口 80 重定向到它的本地 ip 就足够了,我根本不知道这个选项存在。 It is possible to do it with all ports.可以对所有端口执行此操作。 The firewall doesn't seem to influence this, thanks to you防火墙似乎没有影响这一点,多亏了你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM