debianのnginxでredmineをspawn-fcgiで動作させたくなったら
試したのはdebian 8, jessie
redmineのインストール
redmine - Debian Wikiの2までやる。
インストールとは別だが、フォルダ配置が純粋redmineと異なる点に注意
詳細はページ最下段のDifferences_from_upstream_Redmineにある通り
nginxのインストールとconf修正
まずは、インストール
apt install nginx
次は、confを準備・修正
nginxは起動時に/etc/nginx/nginx.confを読み込み、
defaultのnginx.confはinclude /etc/nginx/conf.d/*.confするので
# default.confを読み込まないよう名前を変更 mv /etc/nginx/conf.d/default.conf default # テンプレをredmine.confとしてコピー cp /usr/share/doc/redmine/examples/nginx-alias.conf /etc/nginx/conf.d/redmine.conf
最後に、redmine.confを修正
upstream redmine_default { # the socket a fastcgi process is bound to server unix:/var/run/redmine/sockets/default/fcgi.socket; } server { location / { alias /usr/share/redmine/public; try_files $uri @fcgi; } location @fcgi { include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME /usr/share/redmine/public/$fastcgi_script_name; fastcgi_pass redmine_default; #fastcgi_pass 127.0.0.1:9999; #unixドメインソケットを使わないなら、こっち fastcgi_index index.html; } }
spawn-fcgiとnginxの起動
RAILS_ENV=production spawn-fcgi -U nginx -s /var/run/redmine/sockets/default/fcgi.socket -S -d /usr/share/redmine -- /usr/share/redmine/public/dispatch.fcgi systemctl start nginx
tcpなら、
RAILS_ENV=production spawn-fcgi -a 127.0.0.1 -p 9999 -d /usr/share/redmine -- /usr/share/redmine/public/dispatch.fcgi systemctl start nginx
以上