安装apache服务器后如何指定gitlab url

安装apache服务器后如何指定gitlab url

我首先在本地桌面 ubuntu(用作服务器)上安装了 gitlab-ce,一切正常,当然可以通过 http://192.168.1.6/同一网络上的其他计算机的IP 地址连接到它

现在,安装 apache 服务器后,我无法访问 gitlab-ce,我看到的不是 gitlab 页面,而是 apache 页面!

我想要做的是让 gitlab 可以通过http://192.168.1.6/gitlab,可以吗?

这是我的实际配置:

/etc/gitlab/gitlab.rb

external_url 'http://gitlab.mostafa-home.com:9999'
# Disable nginx
nginx['enable'] = false
# Give apache user privileges to listen to GitLab
web_server['external_users'] = ['www-data']

/etc/apache2/sites-enabled/000-default.conf

<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

谢谢

答案1

启用 mod_proxy 和 mod_proxy_http,并在您的配置中添加 proxypass 指令:

ProxyPass "/gitlab" "http://localhost:9999/"

答案2

你好 mostafa 我需要 50 以上才能回答你的评论。所以我在这里回答了我的评论。

首先创建您的配置文件:

sudo nano /etc/apache2/sites-available/gitlab

创建指向 sites-enabled 的符号链接:

sudo ln -s /etc/apache2/sites-available/gitlab /etc/apache2/sites-enabled/gitlab

在conf文件中添加您必须添加的内容。

重新启动 Apache 服务器:

systemctl restart apache2

检查 Apache 服务器的状态:

systemctl status apache2

相关内容