This project is simple to set up a gitlab server with docker-compose.
- Clone the repository
git clone https://github.com/cslant/gitlab.git- Change to the repository directory
cd gitlab- Create the environment file
cp .env.example .env- Edit the environment file
nano .env- Start the gitlab server
docker-compose up -d- Setup reverse proxy
You can use the following nginx configuration to set up a reverse proxy for the gitlab server.
server_tokens off;root /another/path;add_header Strict-Transport-Security "max-age=63072000" always;add_header X-Frame-Options "SAMEORIGIN";add_header X-XSS-Protection "1; mode=block";add_header X-Content-Type-Options "nosniff";indexindex.html index.php;charset utf-8;client_max_body_size1024m;location / {proxy_http_version 1.1;proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection 'upgrade';proxy_cache_bypass$http_upgrade; # # proxy_read_timeout 86400s; # # proxy_send_timeout 86400s;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_passhttp://127.0.0.1:802;proxy_read_timeout300;proxy_connect_timeout300;proxy_redirect off;proxy_set_header X-Forwarded-Proto https;proxy_set_header X-Frame-Options SAMEORIGIN;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-Forwarded-Ssl on;}location = /favicon.ico {access_log off;log_not_found off;}location = /robots.txt {access_log off;log_not_found off;}access_log off;error_log /var/log/nginx/gitlab.mydomain.io-error.log error;error_page404 /index.php;location~\.php$ {try_files$uri$uri/ =404;fastcgi_split_path_info ^(.+\.php)(/.+)$;fastcgi_pass unix:/var/run/php/php8.4-fpm.sock;fastcgi_indexindex.php;include fastcgi_params;}# Deny files starting with a . (dot) except .well-knownlocation~ /\.(?!well-known).* {deny all;}- Access the gitlab server
Open your browser and go to https://gitlab.mydomain.io