加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails-3 – Gitlab在与apache和乘客的子目录中

发布时间:2020-12-16 20:14:00 所属栏目:百科 来源:网络整理
导读:我正在尝试设置gitlab,以便可以通过现有apache服务器example.com/gitlab的子目录进行访问.我试图使用乘客,因为这似乎是最容易设置的,但其他解决方案也是可以接受的.不幸的是,为gitlab使用单独的虚拟主机不是我的选择. 我的设置 在设定这个时候,我跟着gitlab
我正在尝试设置gitlab,以便可以通过现有apache服务器example.com/gitlab的子目录进行访问.我试图使用乘客,因为这似乎是最容易设置的,但其他解决方案也是可以接受的.不幸的是,为gitlab使用单独的虚拟主机不是我的选择.

我的设置

在设定这个时候,我跟着gitlab setup guide和passenger documentation.

我相信/etc/httpd/conf/httpd.conf最相关的部分如下:

DocumentRoot "/home/.www"

# gitlab config
RackBaseURI /gitlab
<Directory "/home/.www/gitlab">
    Options -MultiViews
</Directory>

apache的DocumentRoot包含gitlab公共目录的符号链接:

$ls -l /home/.www
lrwxrwxrwx  1 root  http    23 Jul 29 12:35 gitlab -> ../gitlab/gitlab/public

Passenger是使用passenger-install-apache2-module脚本安装的,脚本输出的config行包含在apache配置中.

我在config / gitlab.yml中使用了relative_url_root;没有任何效果(从文件中的评论来看,这种机制似乎是不鼓励或不赞成的 – 这将是很好避免它).

结果

当访问example.com/gitlab时,我得到以下输出(纯文本文档):

Not Found: /

Apache的日志表明乘客已经启动,但是至少要从文档根目录中请求favicon.ico,应该从/gitlab/favicon.ico从子目录中请求.

[ 2013-07-29 14:14:12.1029 2037/7f3502e1e740 agents/HelperAgent/Main.cpp:597 ]: PassengerHelperAgent online,listening at unix:/tmp/passenger.1.0.2033/generation-0/request
[ 2013-07-29 14:14:12.1150 2043/7fa24dbf3740 agents/LoggingAgent/Main.cpp:330 ]: PassengerLoggingAgent online,listening at unix:/tmp/passenger.1.0.2033/generation-0/logging
[ 2013-07-29 14:14:12.1154 2034/7ff20a0cb740 agents/Watchdog/Main.cpp:635 ]: All Phusion Passenger agents started!
[Mon Jul 29 14:14:12 2013] [notice] Digest: generating secret for digest authentication ...
[Mon Jul 29 14:14:12 2013] [notice] Digest: done
[ 2013-07-29 14:14:13.0297 2057/7f5380ee3740 agents/Watchdog/Main.cpp:452 ]: Options: { 'analytics_log_user' => 'nobody','default_group' => 'nobody','default_python' => 'python','default_ruby' => '/usr/bin/ruby','default_user' => 'nobody','log_level' => '0','max_instances_per_app' => '0','max_pool_size' => '6','passenger_root' => '/usr/lib/ruby/gems/2.0.0/gems/passenger-4.0.10','pool_idle_time' => '300','temp_dir' => '/tmp','union_station_gateway_address' => 'gateway.unionstationapp.com','union_station_gateway_port' => '443','user_switching' => 'true','web_server_pid' => '2055','web_server_type' => 'apache','web_server_worker_gid' => '33','web_server_worker_uid' => '33' }
[ 2013-07-29 14:14:13.0367 2061/7f92eefef740 agents/HelperAgent/Main.cpp:597 ]: PassengerHelperAgent online,listening at unix:/tmp/passenger.1.0.2055/generation-0/request
[ 2013-07-29 14:14:13.0485 2067/7f4cc5205740 agents/LoggingAgent/Main.cpp:330 ]: PassengerLoggingAgent online,listening at unix:/tmp/passenger.1.0.2055/generation-0/logging
[ 2013-07-29 14:14:13.0490 2057/7f5380ee3740 agents/Watchdog/Main.cpp:635 ]: All Phusion Passenger agents started!
[Mon Jul 29 14:14:13 2013] [notice] Apache/2.2.25 (Unix) mod_ssl/2.2.25 OpenSSL/1.0.1e DAV/2 Phusion_Passenger/4.0.10 configured -- resuming normal operations
[ 2013-07-29 14:14:16.8354 2061/7f92eef2a700 Pool2/Spawner.h:738 ]: [App 2096 stdout] 
[ 2013-07-29 14:14:24.8814 2061/7f92eef2a700 Pool2/SmartSpawner.h:301 ]: Preloader for /home/.www/../gitlab/gitlab started on PID 2096,listening on unix:/tmp/passenger.1.0.2055/generation-0/backends/preloader.2096
[Mon Jul 29 14:14:25 2013] [error] [client 129.241.220.221] File does not exist: /home/.www/favicon.ico

在我看来,它不应该有必要启动任何美洲狮服务器或类似的,所以我没有运行任何bundle exec rake …命令启动任何rails相关的生成上面的日志(我已经尝试,但我’ m不包括这里的输出,因为它似乎与我相同).

有没有人看到我在做错什么?

解决方法

我不认为Passenger是配置Apache GitLab最简单的方式.使用本地反向代理实际上更简单.

GitLab(6.0)的最新版本是使用Unicorn,但与Puma几乎相同.

在你的config / unicorn.rb文件中,注释listen指令并添加:

listen "127.0.0.1:9242"

在您的Apache配置中,您可以添加

ProxyPass         /gitlab http://127.0.0.1:9242
ProxyPassReverse  /gitlab http://127.0.0.1:9242

重新启动Apache和GitLab,它应该工作.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读