Eagle
Eagle

Reputation: 3474

How to place GitLab behind nginx

I just got a Raspberry Pi 4B and i would like to place on it Nextcloud and Gitlab servers.

Using the instructions i was able to install GitLab successfully on my RPI4.

As second step I diceded to install Nginx, since i would like to run more then one server on RPI4.

I followed the instructions and added gitlab-omnibus-nginx.conf to my

/etc/nginx/modules-enabled/

as I tried to restart my nginx i got using sudo nginx -t an error:

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

I belived that the problem is not there, since if i commit this line, i get

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

My /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/*;
}

Upvotes: 0

Views: 923

Answers (1)

Chico
Chico

Reputation: 26

It looks the sample from /etc/nginx/modules-enabled/gitlab-omnibus-nginx.conf is not a valid nginx config file, but just a snippet instead. The upstream and the server blocks need to be nested within the http block of your nginx config file.

Upvotes: 1

Related Questions