我有Jira设置为服务于我的服务器myserver:8080 。
有一个DNS指向jira.otherserver到myserver的IP地址的引用。 (其他otherserver将在未来主持Jira设置)
根据这里的其他答案,我尝试启用mod_proxy,并将以下内容添加到myserver httpd.conf中:
<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)。 我仍然可以通过http://myserver:8080访问jira
我究竟做错了什么?
编辑:我也可以在jira.otherserver:8080访问Jira jira.otherserver:8080 ,所以DNS工作正常
编辑2:我按照答案中的build议,并修改了部分
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
您应该在<VirtualHost *:80>之前的端口80上启用虚拟主机: NameVirtualHost *:80 ,并从ServerName jira.otherserver/删除结尾斜杠ServerName jira.otherserver/