devo devo - 1 month ago 13
Apache Configuration Question

Uploaded avatar image not getting displayed in GitLab

On my gitlab config

/etc/gitlab/gitlab.rb
, I have only the following code un-commented.

external_url 'http://gitlab.mydomain.com:8888'
unicorn['worker_timeout'] = 6000
unicorn['port'] = 8888
web_server['external_users'] = ['www-data']
nginx['enable'] = false
ci_nginx['enable'] = false


Again reconfigured by running,

sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart


And configured virtual host for apache on
/opt/bitnami/apache2/conf/bitnami/httpd.conf


<VirtualHost *:80>
ServerName gitlab.mydomain.com
DocumentRoot /opt/gitlab/

ProxyPass / http://127.0.0.1:8888/
ProxyPassReverse / http://127.0.0.1:8888/

# Custom log file locations
ErrorLog /opt/bitnami/apache2/logs/gitlab_error.log
CustomLog /opt/bitnami/apache2/logs/gitlab_access.log combined
</VirtualHost>


When I updated profile avatar, the file is getting uploaded on
/opt/gitlab/embedded/service/gitlab-rails/public/uploads/user/avatar/2/avatar.png


But the image is not getting displayed in web interface and the image location attached to interface is
http://gitlab.mydomain.com:8888/uploads/user/avatar/2/avatar.png


I can directly access the avatar on
http://gitlab.mydomain.com/uploads/user/avatar/2/avatar.png
.

How can I mode_rewrite all the requests on port 8888 to not have the port number? Or any other solutions to fix this?

Answer

As mentioned in "Gitlab and Apache - Uploaded images 404 errors", you don't need to specify the port in external_url.

In your case, that would be:

external_url 'http://gitlab.mydomain.com'

Then the url displayed would consistently be http://gitlab.mydomain.com, not http://gitlab.mydomain.com:8888.