【问题标题】:How to place GitLab behind nginx如何将 GitLab 放在 nginx 后面
【发布时间】:2021-04-04 12:35:02
【问题描述】:

我刚得到一个 Raspberry Pi 4B,我想在上面放置 Nextcloud 和 Gitlab 服务器。

使用instructions 我能够在我的 RPI4 上成功安装 GitLab。

作为第二步,我决定安装 Nginx,因为我想在 RPI4 上运行不止一台服务器。

我关注了instructions并将gitlab-omnibus-nginx.conf添加到我的

/etc/nginx/modules-enabled/

当我尝试重新启动我的 nginx 时,使用 sudo nginx -t 时出现错误:

nginx: [emerg] "upstream" directive is not allowed here in /etc/nginx/modules-enabled/gitlab-omnibus-nginx.conf:19
nginx: configuration file /etc/nginx/nginx.conf test failed

我相信问题不存在,因为如果我提交这一行,我就会得到

nginx: [emerg] "server" directive is not allowed here in /etc/nginx/modules-enabled/gitlab-omnibus-nginx.conf:23
nginx: configuration file /etc/nginx/nginx.conf test failed

我的 /etc/nginx/nginx.conf:

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
}

http {
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    gzip on;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

【问题讨论】:

    标签: nginx gitlab


    【解决方案1】:

    它看起来 /etc/nginx/modules-enabled/gitlab-omnibus-nginx.conf 中的示例不是有效的 nginx 配置文件,而只是一个 sn-p。 upstreamserver 块需要嵌套在 nginx 配置文件的 http 块中。

    【讨论】:

    • 我发现了问题。你是对的,它与http有关。 *.conf 的包含两次,一个带有 http 块,一个没有。
    猜你喜欢
    • 2014-06-15
    • 2013-04-08
    • 1970-01-01
    • 2022-06-28
    • 1970-01-01
    • 2012-02-24
    • 2020-09-25
    • 1970-01-01
    • 2022-10-06
    相关资源
    最近更新 更多