我的服务器在端口 8080 上运行 ISPConfig 控制面板,因此我尝试在端口 9000 上为 Gitlab 配置代理,但是出现了 502 错误。很可能是我忽略了一个明显的错误。
System information
System: Debian 10
Current User: git
Using RVM: no
Ruby Version: 2.7.2p137
Gem Version: 3.1.4
Bundler Version:2.1.4
Rake Version: 13.0.3
Redis Version: 6.0.12
Git Version: 2.31.1
Sidekiq Version:5.2.9
Go Version: go1.11.6 linux/amd64
GitLab information
Version: 13.12.4
Revision: 02b97bd2a77
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 12.6
URL: http://dev.example.com
HTTP Clone URL: http://dev.example.com/some-group/some-project.git
SSH Clone URL: [email protected]:some-group/some-project.git
Using LDAP: no
Using Omniauth: yes
Omniauth Providers:
GitLab Shell
Version: 13.18.0
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell
Git: /opt/gitlab/embedded/bin/git
并且,我的 /etc/apache2/sites-enabled/100-dev.example.com.vhost 包含:
<Directory /var/www/dev.example.com>
AllowOverride None
Require all denied
</Directory>
<VirtualHost *:80>
DocumentRoot /var/www/dev.example.com/web
ServerName dev.example.com
ServerAdmin [email protected]
ErrorLog /var/log/ispconfig/httpd/dev.example.com/error.log
Alias /error/ "/var/www/dev.example.com/web/error/"
ErrorDocument 400 /error/400.html
ErrorDocument 401 /error/401.html
ErrorDocument 403 /error/403.html
ErrorDocument 404 /error/404.html
ErrorDocument 405 /error/405.html
ErrorDocument 500 /error/500.html
ErrorDocument 502 /error/502.html
ErrorDocument 503 /error/503.html
<Directory /var/www/dev.example.com/web>
# Clear PHP settings of this website
<FilesMatch ".+\.ph(p[345]?|t|tml)$">
SetHandler None
</FilesMatch>
Options +SymlinksIfOwnerMatch
AllowOverride All
Require all granted
<Files ~ '.php[s3-6]{0,1}$'>
Require all denied
</Files>
</Directory>
<Directory /var/www/clients/client0/web8/web>
# Clear PHP settings of this website
<FilesMatch ".+\.ph(p[345]?|t|tml)$">
SetHandler None
</FilesMatch>
Options +SymlinksIfOwnerMatch
AllowOverride All
Require all granted
<Files ~ '.php[s3-6]{0,1}$'>
Require all denied
</Files>
</Directory>
# add support for apache mpm_itk
<IfModule mpm_itk_module>
AssignUserId web8 client0
</IfModule>
<IfModule mod_dav_fs.c>
# Do not execute PHP files in webdav directory
<Directory /var/www/clients/client0/web8/webdav>
<ifModule mod_security2.c>
SecRuleRemoveById 960015
SecRuleRemoveById 960032
</ifModule>
<FilesMatch "\.ph(p3?|tml)$">
SetHandler None
</FilesMatch>
</Directory>
DavLockDB /var/www/clients/client0/web8/tmp/DavLock
# DO NOT REMOVE THE COMMENTS!
# IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
# WEBDAV BEGIN
# WEBDAV END
</IfModule>
ServerName dev.example.com
ServerAdmin [email protected]
ServerSignature Off
ProxyPreserveHost On
<Proxy *>
Require all granted
</Proxy>
ProxyPass / http://127.0.0.1:9000/
ProxyPassReverse / http://dev.example.com/
AllowEncodedSlashes NoDecode
<Location />
Require all granted
</Location>
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_URI} ^/uploads/.*
RewriteRule .* http://127.0.0.1:9000%{REQUEST_URI} [P,QSA,NE]
</VirtualHost>
有人能解释一下我犯的“明显的错误”吗?谢谢。
答案1
不能保证一定能解决问题,但是:
ProxyPass / http://127.0.0.1:9000/
ProxyPassReverse / http://dev.example.com/
据我所知,这是错误的。可能应该是:
ProxyPass / http://127.0.0.1:9000/
ProxyPassReverse / http://127.0.0.1:9000/