如何从 80 以外的其他端口从 apache2(linux 来自 GCP)访问网站?
How to access website from apache2 (linux from GCP) from other port than 80?
我想在 Google 云上使用 Linux 实例托管一个 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
但是当我访问我的网站时 url 因为 http://IPAdressOfServer:8080/ 服务器正在返回 ERR_CONNECTION_TIMED_OUT。
我具体需要做什么才能使其正确?
您必须从 Google 项目控制台打开防火墙端口 8080。请参阅此 link:https://console.cloud.google.com/networking/firewalls/list?project=[your-project-id]。将 your-project-id 替换为您的 Google 项目
的 ID
我想在 Google 云上使用 Linux 实例托管一个 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
但是当我访问我的网站时 url 因为 http://IPAdressOfServer:8080/ 服务器正在返回 ERR_CONNECTION_TIMED_OUT。
我具体需要做什么才能使其正确?
您必须从 Google 项目控制台打开防火墙端口 8080。请参阅此 link:https://console.cloud.google.com/networking/firewalls/list?project=[your-project-id]。将 your-project-id 替换为您的 Google 项目
的 ID