我想使用 Linux 实例在 Google Cloud 上托管一个 WordPress 网站。 已经有网站在 80 端口上运行,我希望我的新网站托管在 80 以外的任何端口上。 我更改了以下 ports.conf 和 mywebsite.conf 以实现此目的
/etc/apache2/ports.conf
现有代码
Listen 80
新代码
Listen 80
Listen 8080
我用 VirtualHost 创建了以下文件
/etc/apache2/sites-available/mywebsite.conf
代码
<VirtualHost *:8080>
ServerAdmin adminemail@gmail.com
DocumentRoot /var/www/mywebsite.com
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/mywebsite.com/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
进行这些更改后,我只是运行了一些命令,如下所示
$sudo a2ensite mywebsite.conf
$service apache2 restart
但是当我将我的网站网址设为 http://IPAdressOfServer:8080/ 时服务器正在返回 ERR_CONNECTION_TIMED_OUT。
我究竟需要做什么才能使其正确?
最佳答案
您必须从 Google 项目控制台打开防火墙端口 8080。请参阅此链接:https://console.cloud.google.com/networking/firewalls/list?project=[your-project-id] .将 your-project-id 替换为您的 Google 项目的 ID
关于linux - 如何从 80 以外的其他端口从 apache2(来自 GCP 的 linux)访问网站?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40669441/