首页 > 解决方案 > 如何在 GCE VM 实例中安装 Apache 服务器?

问题描述

我尝试通过以下命令在 GCE VM 中安装 apache 服务器:

sudo docker pull httpd
sudo docker run -d --name apache-server -p 86:80 httpd                          
sudo docker container start apache-server

但是当我尝试点击端口http://34.138.232.98:86/时,我得到以下信息:

Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

我安装了Apache但得到NGINX,无法理解这里到底发生了什么。

标签: google-cloud-platformgoogle-compute-engine

解决方案


看起来您的容器中正在运行另一个阻止端口的 http 服务器。

尝试创建一个新的 VM 并仅运行命令sudo docker pull httpd& sudo docker run -d --name apache-server -p 86:80 httpd

docker run启动容器,因此您不需要 docker start 它。

尝试新的 VM(最好是容器优化的操作系统)。如果这是您唯一需要在其上运行sudo apt install apache2 -y并允许使用sudo ufw allow 'WWW'.

还要确保您的GPS 防火墙允许进出流量。


推荐阅读