I have an omnibus package installation of GitLab
on my web server.
I disabled nginx in the gitlab.rb using nginx['enable'] = false
because I wanted to create multiple servers reachable by multiple subdomains.
The problem now is whenever I call my GitLab in the browser, it gets a 403 forbidden error.
Since this is a permission error, I expected to maybe use the wrong user here, but I also added web_server['external_users'] = ['www-data']
in the gitlab.rb file and double checked nginx's config file – the user is called 'www-data' as usual.
Have a look at my full config file:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
And here is my server configuration:
server {
server_name gitlab.example.com;
root /var/opt/gitlab;
index index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
}
What am I missing here?
Note: Using an existing Passenger/Nginx installation does mention you need to disable the built-in Nginx and Unicorn:
# Disable the built-in unicorn
unicorn['enable'] = false
Make sure you run
sudo gitlab-ctl reconfigure
for the changes to take effect.
Issue 692 also mentions:
I compiled nginx with passenger support.
I installed passenger :yum install passenger
.
I add the server block to avhost
file as instructed.
But it's not working till I see how to proper install passenger onto nginx:Refer to 2.3.3 of this page
Open
/etc/nginx/nginx.conf
and putpassenger_root /path-to-locations.ini;
under thehttp
sectionThe real path is the output of
passenger-config --root
Restart the nginx server and it should work (for me).
Warning:
I had different versions between my
ruby
andpassenger_ruby
after a fresh GitLab migration on a new server.
I had to change my ruby version and then install passenger again in order to correct this problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.