簡體   English   中英

如何從80以外的其他端口通過apache2(GCP的Linux)訪問網站?

[英]How to access website from apache2 (linux from GCP) from other port than 80?

我想在帶有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 Project控制台打開防火牆端口8080。 看到此鏈接: https : //console.cloud.google.com/networking/firewalls/list?project=[your-project-id] 將your-project-id替換為您的Google Project的ID

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM