Apache-2.2
使埠顯示為子域
我已將 Jira 設置為在
myserver:8080
.有一個指向
jira.otherserver
ip 地址的DNS A 引用myserver
。(otherserver
將來會託管 Jira 設置)根據此處的其他答案,我嘗試啟用 mod_proxy,並將以下內容添加到我的
httpd.conf
onmyserver
:<VirtualHost *:80> ServerName jira.otherserver/ ProxyPreserveHost On # setup the proxy <Proxy *> Order allow,deny Allow from all </Proxy> ProxyPass http://jira.otherserver/ http://localhost:8080/ ProxyPassReverse http://jira.otherserver/ http://localhost:8080/ </VirtualHost>
但是,當我訪問
http://jira.otherserver
它時,它會給我一個通用的起始頁(phpinfo)。我仍然可以在以下位置訪問 jirahttp://myserver:8080
我究竟做錯了什麼?
編輯:我也可以在 訪問 Jira
jira.otherserver:8080
,所以 DNS 工作正常編輯2:我遵循了答案中的建議,並將該部分修改為
NameVirtualHost *:80 <VirtualHost *:80> ServerName jira.software-task ProxyPreserveHost On # setup the proxy <Proxy *> Order allow,deny Allow from all </Proxy> ProxyPass "/" "http://localhost:8080/" ProxyPassReverse "/" "http://localhost:8080/" </VirtualHost>
現在連接到
jira.otherserver
會導致錯誤 500,日誌中包含以下內容:[Fri Nov 18 13:40:03 2016] [warn] proxy: No protocol handler was valid for the URL /. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
httpd -M
輸出以下內容:M:\>httpd -M Loaded Modules: core_module (static) win32_module (static) mpm_winnt_module (static) http_module (static) so_module (static) actions_module (shared) alias_module (shared) asis_module (shared) auth_basic_module (shared) authn_alias_module (shared) authn_default_module (shared) authn_file_module (shared) authnz_ldap_module (shared) authz_default_module (shared) authz_groupfile_module (shared) authz_host_module (shared) authz_user_module (shared) autoindex_module (shared) cgi_module (shared) dav_module (shared) dav_fs_module (shared) dir_module (shared) env_module (shared) include_module (shared) isapi_module (shared) ldap_module (shared) log_config_module (shared) mime_module (shared) negotiation_module (shared) proxy_module (shared) rewrite_module (shared) setenvif_module (shared) dav_svn_module (shared) authz_svn_module (shared) php5_module (shared) Syntax OK
您應該在埠 80 上啟用虛擬主機:
NameVirtualHost *:80
之前<VirtualHost *:80>
並刪除尾部斜杠ServerName jira.otherserver/