apache 2.4 + gitlab + letsencrypt不能正常工作

我使用以下configuration在所有虚拟主机上启用letsencrypt支持:

ProxyPass /.well-known/acme-challenge ! Alias /.well-known/acme-challenge/ /var/www/letsencrypt/.well-known/acme-challenge/ <Directory "/var/www/letsencrypt/.well-known/acme-challenge/"> Options None AllowOverride None ForceType text/plain RedirectMatch 404 "^(?!/\.well-known/acme-challenge/[\w-]{43}$)" </Directory> 

这适用于所有主机(主要是php或静态网站),除了gitlab

我使用这个configuration: https : //github.com/gitlabhq/gitlab-recipes/blob/master/web-server/apache/gitlab-ssl-apache24.conf

我的猜测是这个configuration部分是一个问题:

 <Location /> # New authorization commands for apache 2.4 and up # http://httpd.apache.org/docs/2.4/upgrading.html#access Require all granted #Allow forwarding to gitlab-workhorse ProxyPassReverse http://127.0.0.1:8181 ProxyPassReverse http://YOUR_SERVER_FQDN/ </Location> 

但是解决这个问题的最好方法是什么?

我认为这里有两个问题:

  1. DocumentRoot/var/www/letsencrypt之外的东西
  2. gitlab-workhorse正在重写请求

别名的东西应该解决第一个问题,但是这个添加应该允许知名的请求不被GitLab重写。 根据评论:

 #Forward all requests to gitlab-workhorse except existing files like error documents 

Gitlab已经写了一个排除规则,所以我们可以添加到它。

RewriteRule之前添加以下行

 RewriteCond %{REQUEST_URI} !^.*/\.well-known/.*$ [NC] 

这增加了一个有条件的不重写包含.well-known的请求。 重新启动Apache并testing。