我拥有最新的Omnibus GitLab Docker映像,docker-compose.yml
如下所示:
web:
image: 'gitlab/gitlab-ce:latest'
restart: always
hostname: 'some_ip'
container_name: 'some_name'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://some_ip'
gitlab_rails['gitlab_shell_ssh_port'] = 4381
nginx['redirect_http_to_https'] = true
nginx['redirect_http_to_https_port'] = 80
ports:
- '6312:443'
- '4381:22'
volumes:
- '/srv/gitlab/config:/etc/gitlab'
- '/srv/gitlab/logs:/var/log/gitlab'
- '/srv/gitlab/data:/var/opt/gitlab'
访问https://some_ip:6312时可以正常工作,但对于some_ip:6312则显示:
400错误的请求普通的HTTP请求已发送到HTTPS端口nginx
原因很明显,但是如何解决呢?我必须为nginx设置ssl off
,如果是的话,如何为Docker映像设置呢?
我尝试过添加以下几行的不同组合,但没有成功:
nginx['redirect_http_to_https'] = true
nginx['redirect_http_to_https_port'] = 80
gitlab_rails['gitlab_https'] = false
gitlab_rails['gitlab_port'] = 443
nginx['ssl'] = 'off'
nginx['listen_port'] = 443
nginx['listen_https'] = false
编辑:
简而言之:我希望将通过some_ip:6312
或http://some_ip:6312
连接到网站的用户重定向到https://some_ip:6312
。
答案 0 :(得分:0)
不可能在同一端口上运行http
和https
https://askubuntu.com/questions/860511/is-it-possible-to-set-same-port-work-with-http-and-https
当您使用https://domain/
时,端口将自动假定为443
,对于http://domain/
,端口将被假定为80
。因此,它们实际上都在不同的端口上运行。