通过 apache 反向代理运行 gitlab 和 tomcat

通过 apache 反向代理运行 gitlab 和 tomcat

两天来我一直在尝试让 tomcat 和 gitlab 在同一个顶级域上工作。我的 tomcat 在端口上运行8080,而我的 gitlab 在 上运行8081。当我输入时mywebsite.com:8081,我成功重定向到 gitlab,当我输入时,mywebsite.com:8080我成功重定向到我的 tomcat 实例。现在我安装apache 2并让它在端口上运行80,并尝试将其用作反向代理,但每次我输入时http://www.mywebsite.com/gitlab都会出现 404。

我正在使用 Debian,因此必须编辑/etc/apache2/sites-available/000-default.conf 此配置。现在内容如下:

NameVirtualHost *:80
<VirtualHost *:80>
Servername www.mywebsite.com

<Proxy *>
Order deny, allow
Allow from all
</Proxy>
ProxyPreserveHost On
ProxyPass /gitlab http://www.mywebsite.com:8081
ProxyPassReverse /gitlab http://www.mywebsite.com:8081

这不对吗?我是不是漏掉了什么致命的东西?我已经看了几份说明书,但我仍然不知道该怎么做

编辑://

Apache 2Access 日志是空的...

Apache 2 错误日志:

[Fri Mar 03 08:40:32.654879 2017] [mpm_event:notice] [pid 985:tid 140413383284608] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Fri Mar 03 08:40:32.712726 2017] [core:notice] [pid 985:tid 140413383284608] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 03 08:40:56.608184 2017] [mpm_event:notice] [pid 985:tid 140413383284608] AH00491: caught SIGTERM, shutting down
[Fri Mar 03 09:55:19.844429 2017] [mpm_event:notice] [pid 7370:tid 140501655910272] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Fri Mar 03 09:55:19.852533 2017] [core:notice] [pid 7370:tid 140501655910272] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 03 10:03:28.220153 2017] [mpm_event:notice] [pid 7370:tid 140501655910272] AH00491: caught SIGTERM, shutting down
[Fri Mar 03 10:42:06.430282 2017] [mpm_event:notice] [pid 14147:tid 140077848672128] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Fri Mar 03 10:42:06.433243 2017] [core:notice] [pid 14147:tid 140077848672128] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 03 11:04:47.177689 2017] [mpm_event:notice] [pid 14147:tid 140077848672128] AH00491: caught SIGTERM, shutting down
[Fri Mar 03 11:04:48.289315 2017] [mpm_event:notice] [pid 15822:tid 139992495703936] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Fri Mar 03 11:04:48.289386 2017] [core:notice] [pid 15822:tid 139992495703936] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 03 11:07:07.000803 2017] [mpm_event:notice] [pid 15822:tid 139992495703936] AH00491: caught SIGTERM, shutting down
[Fri Mar 03 11:07:08.155106 2017] [mpm_event:notice] [pid 16111:tid 139796633421696] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Fri Mar 03 11:07:08.155170 2017] [core:notice] [pid 16111:tid 139796633421696] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 03 11:18:54.854977 2017] [mpm_event:notice] [pid 16111:tid 139796633421696] AH00491: caught SIGTERM, shutting down
[Fri Mar 03 11:18:56.001210 2017] [mpm_event:notice] [pid 17055:tid 139735864428416] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Fri Mar 03 11:18:56.001277 2017] [core:notice] [pid 17055:tid 139735864428416] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 03 11:19:40.649005 2017] [mpm_event:notice] [pid 17055:tid 139735864428416] AH00491: caught SIGTERM, shutting down
[Fri Mar 03 11:19:41.757264 2017] [mpm_event:notice] [pid 17230:tid 140277624301440] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Fri Mar 03 11:19:41.757327 2017] [core:notice] [pid 17230:tid 140277624301440] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 03 11:34:57.313779 2017] [mpm_event:notice] [pid 17230:tid 140277624301440] AH00491: caught SIGTERM, shutting down
[Fri Mar 03 11:35:50.648583 2017] [mpm_event:notice] [pid 963:tid 140495805245312] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Fri Mar 03 11:35:50.708563 2017] [core:notice] [pid 963:tid 140495805245312] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 03 11:41:29.786364 2017] [mpm_event:notice] [pid 963:tid 140495805245312] AH00491: caught SIGTERM, shutting down
[Fri Mar 03 11:41:30.892008 2017] [mpm_event:notice] [pid 1854:tid 140138175350656] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Fri Mar 03 11:41:30.892054 2017] [core:notice] [pid 1854:tid 140138175350656] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 03 11:43:54.349607 2017] [mpm_event:notice] [pid 1854:tid 140138175350656] AH00491: caught SIGTERM, shutting down
[Fri Mar 03 11:43:55.462423 2017] [mpm_event:notice] [pid 2137:tid 139958606403456] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Fri Mar 03 11:43:55.462478 2017] [core:notice] [pid 2137:tid 139958606403456] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 03 11:44:44.826290 2017] [mpm_event:notice] [pid 2137:tid 139958606403456] AH00491: caught SIGTERM, shutting down
[Fri Mar 03 11:50:24.895545 2017] [mpm_event:notice] [pid 989:tid 140278705215360] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Fri Mar 03 11:50:24.935196 2017] [core:notice] [pid 989:tid 140278705215360] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 03 11:53:08.091834 2017] [mpm_event:notice] [pid 989:tid 140278705215360] AH00491: caught SIGTERM, shutting down
[Fri Mar 03 11:53:09.210269 2017] [mpm_event:notice] [pid 1566:tid 140261252605824] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Fri Mar 03 11:53:09.210324 2017] [core:notice] [pid 1566:tid 140261252605824] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 03 12:08:22.544593 2017] [mpm_event:notice] [pid 1566:tid 140261252605824] AH00491: caught SIGTERM, shutting down
[Fri Mar 03 12:08:23.651021 2017] [mpm_event:notice] [pid 2818:tid 140229764982656] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Fri Mar 03 12:08:23.651070 2017] [core:notice] [pid 2818:tid 140229764982656] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 03 12:17:44.795400 2017] [mpm_event:notice] [pid 2818:tid 140229764982656] AH00491: caught SIGTERM, shutting down
[Fri Mar 03 12:17:45.967588 2017] [mpm_event:notice] [pid 3611:tid 139673959495552] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Fri Mar 03 12:17:45.967642 2017] [core:notice] [pid 3611:tid 139673959495552] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 03 12:33:17.478860 2017] [mpm_event:notice] [pid 3611:tid 139673959495552] AH00491: caught SIGTERM, shutting down
[Fri Mar 03 12:33:50.519860 2017] [mpm_event:notice] [pid 979:tid 139745101391744] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Fri Mar 03 12:33:50.563235 2017] [core:notice] [pid 979:tid 139745101391744] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 03 12:35:44.783856 2017] [mpm_event:notice] [pid 979:tid 139745101391744] AH00491: caught SIGTERM, shutting down
[Fri Mar 03 12:35:47.063628 2017] [auth_digest:notice] [pid 1875:tid 140058368026496] AH01757: generating secret for digest authentication ...
[Fri Mar 03 12:35:47.064726 2017] [lbmethod_heartbeat:notice] [pid 1875:tid 140058368026496] AH02282: No slotmem from mod_heartmonitor
[Fri Mar 03 12:35:48.194526 2017] [mpm_event:notice] [pid 1875:tid 140058368026496] AH00489: Apache/2.4.10 (Debian) OpenSSL/1.0.1t configured -- resuming normal operations
[Fri Mar 03 12:35:48.194669 2017] [core:notice] [pid 1875:tid 140058368026496] AH00094: Command line: '/usr/sbin/apache2'

答案1

根据您的标签,您使用的是 Apache 2.4。为此,权限语法有已更改

新的语法将是

Require all granted

但我认为,<Proxy>以目前的形式,这个块是没有必要的。

相关内容