Redmine啟用FastCGI

來源:互聯網
上載者:User

緊接前文,我希望能夠用FastCGI協議和Nginx互動,這樣就能用在產品環境下。

Redmine啟用FastCGI文檔不全,靠自己揣摩和Google得到的零散資訊,得到如下配置方法:

1. 安裝需要的開發庫

apt-get install libfcgi-dev

2. 在redmine目錄下建立檔案Gemfile.locale, 內容如下:

gem "fcgi"

3. 安裝依賴,再次運行下面的命令:

bundle install --without development test

4. 強制環境變數為production,在conf/environment.rb中第一行添加:

ENV['RAILS_ENV'] ||= 'production'

5. 安裝啟動fastcgi的工具軟體

apt-get install spawn-fcgi

6. 啟動:

spawn-fcgi -p 9001 -f ./public/dispatch.fcgi

現在檢查一下是否監聽了9001連接埠:

root@redmine:~/redmine-2.3# fuser -n tcp 90019001/tcp:            26510root@redmine:~/redmine-2.3# ps -def | grep dispatchroot     26510     1  2 12:53 ?        00:00:04 ruby ./public/dispatch.fcgi

7. 現在假定已經安裝了Nginx,在conf.d/default.conf檔案中添加幾行配置:

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9001                                                                                                             location / {                                                                                                                    fastcgi_pass   127.0.0.1:9001; fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;include        fastcgi_params;    }

8. 開啟網頁測試,通過!!!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.