I’m trying to deploy a Rails app to a new server with Deprec and Capistrano Server Extensions (capserverext). The capistrano task fails when compiling nginx, during the `make install` bit. The make errors are something like this:
cp: cannot create regular file `/usr/local/nginx/conf/mime.types.default' No such file or directory
I tried compiling nginx directly, to eliminate deprec and capserverext, and the problem persisted.
After much head beating, and with disbelief, I concluded that the problem was a bug in nginx. Hubristic, I know. But searching the nginx mailing list immediately turned up a message with a patch from the developer. The ‘@@’s in this patch is munged on the web, so I pastied it for your consumption.
The problem stems from the addition of a new configure option,
--sysconfdir. This new option means that capserverext is going to need a change to the compile_nginx task.
Once patched, you can run configure with
--sysconfdir=/usr/local/nginx/conf to meet capserverext’s assumptions. But having to patch the source breaks the whole install_nginx task anyway.
What you do, though, is bravely pretend that prepare_host is going to work. When it fails:
- ssh into the server and cd to /usr/local/src/nginx-0.6.6/
- wget http://pastie.caboo.se/84215.txt
- patch -p0 < 84215.txt
- run the configure script with the arguments from capserverext’s nginx recipe plus –sysconfdir=/usr/local/nginx/conf
sudo ./configure --sbin-path=/usr/local/sbin \ --pid-path=/var/run/nginx.pid \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/log/nginx/access.log \ --with-http_ssl_module \ --sysconfdir=/usr/local/nginx/conf
- sudo make
- sudo make install
- rm /usr/local/nginx/conf/nginx.conf
Now nginx 0.6.6 should be installed on your server. Back on your dev machine run the following tasks to get back on track:
cap nginx_postgres_rails_setup( or
cap nginx_mysql_rails_setup, if you’re using mysql)
This gets you past the prepare_host task.
Here’s hoping this post becomes obsolete very soon.