首页 > 解决方案 > 如何在 gitlab 旁边设置 django?

问题描述

Gitlab安装在服务器上,它挂在git.domain.com子域上,我需要网站挂在domain.com上,当我尝试去这个域时,浏览器发誓缺少ssl,我尝试谷歌搜索,我得到了这个配置

# the upstream component nginx needs to connect to
upstream django {
    server unix:///home/web/project/uwsgi_nginx.sock; # for a file socket
    # server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}

# configuration of the server
server {
    # the port your site will be served on
    listen      8001;

    listen 444 ssl http2 default_server;
    listen [::]:444 ssl http2 default_server;
    server_name domain.com;

    ssl_certificate /etc/gitlab/ssl/domain.com.crt;
    ssl_certificate_key /etc/gitlab/ssl/domain.com.key; 

    # the domain name it will serve for
    server_name domain.com www.domain.com; # substitute your machine's IP address or FQDN
    charset     utf-8;

    # max upload size
    client_max_body_size 75M;   # adjust to taste

    # Django media
    location /media  {
    alias /home/web/project/media;  # your Django project's media files - amend as required
    }

    location /static {
    alias /home/web/project/static; # your Django project's static files - amend as required
    }

    # Finally, send all non-media requests to the Django server.
    location / {
    uwsgi_pass  django;
    include     /home/web/project/deployment/uwsgi_params; # the uwsgi_params file you installed
    }
}

但是结果是一样的,浏览器骂的就是缺少ssl。我尝试在运行之后letsencrypt['enable'] = false的 gitlab 设置中禁用letsencrypt,但gitlab 仍然使用ssl。/etc/gitlab/gitlab.rbsudo gitlab-ctl reconfigure

我不明白如何配置 nginx 以使我的网站正常工作

标签: djangonginxsslgitlab

解决方案


推荐阅读