/mt-starman-daemon

Run Movable Type with nginx and PSGI

Primary LanguageShell

Run Movable Type with nginx and PSGI on Debian

1. Debian

  1. Install cpanminus:
curl -L http://cpanmin.us | perl - --sudo App::cpanminus`
  1. Install Perl modules:
cpanm Task::Plack XMLRPC::Transport::HTTP::Plack Starman
  1. Place in /etc/init.d mt-starman:
wget -P /etc/init.d https://raw.github.com/saahov/mt-starman-daemon/master/debian/mt-starman
  1. Change permissions:
chmod +x /etc/init.d/mt-starman
  1. Change variables (DIR, SCRIPT, USER, GROUP, WORKERS) in /etc/init.d/mt-starman.

  2. Add mt-starman to Debian autostart:

update-rc.d mt-starman defaults

If you use Debian Squeeze (and above):

insserv mt-starman

2. nginx

  1. Add to nginx.conf (http section):
upstream starman {
    server 127.0.0.1:50000;
}
  1. Add to nginx site config (server section):
location /cgi-bin/mt/ {
    proxy_set_header        Host $http_host;
    proxy_set_header        X-Forwarded-Host $host;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass      http://starman;
}

3. Movable Type

  1. Add to mt-config.cgi:
PIDFilePath /var/run/mt.pid
  1. Also you can add this in mt-config.cgi (for beautiful url's without extensions):
AdminScript app
CommentScript comments
TrackbackScript trackbacks
SearchScript search
XMLRPCScript xmlrpc
AtomScript atom
UpgradeScript upgrade

Finally

Run this command to start Starman and restart nginx:

/etc/init.d/mt-starman start && /etc/init.d/nginx restart