0
我有我的服務器端http://example.co.uk,它可以在網絡瀏覽器(或通過正常的http請求)訪問到http://example.co.uk。但是,對於我的應用程序能夠訪問服務器端,我希望它能夠訪問完全相同的內容在端口5678上。所以我試圖在我的apache配置中的虛擬主機中編程:編程Apache VirtualHosts使站點可以從兩個端口訪問
<VirtualHost 184.107.24.1:80>
ServerName example.co.uk
ServerAlias www.example.co.uk
DocumentRoot /home/example/public_html
ServerAdmin [email protected]
UseCanonicalName Off
CustomLog /usr/local/apache/domlogs/example.co.uk combined
CustomLog /usr/local/apache/domlogs/example.co.uk-bytes_log "%{%s}t %I .\n%{%s}t %O ."
## User example # Needed for Cpanel::ApacheConf
UserDir enabled example
<IfModule mod_suphp.c>
suPHP_UserGroup example example
</IfModule>
<IfModule !mod_disable_suexec.c>
<IfModule !mod_ruid2.c>
SuexecUserGroup example example
</IfModule>
</IfModule>
<IfModule mod_ruid2.c>
RUidGid example example
</IfModule>
ScriptAlias /cgi-bin/ /home/example/public_html/cgi-bin/
# To customize this VirtualHost use an include file at the following location
# Include "/usr/local/apache/conf/userdata/std/2/example/example.co.uk/*.conf"
</VirtualHost>
(這是我原來的)。我曾嘗試加入Listen 5678
並添加3行有關代理請求:
ProxyRequest Off
ProxyPass/http://example.co.uk:5678/
ProxyPassReverse/http://example.co.uk:5678/
感謝虛擬主機的定義 - 即似乎工作。從示例中可以看到,它表示不會編輯,因爲它是由WHM/cPanel自動生成的。任何想法,我會如何添加這個東西更永久,所以cPanel不會擺脫它?謝謝。 –