nginx 0.6.6 – make install fails

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:

  1. ssh into the server and cd to /usr/local/src/nginx-0.6.6/
  2. wget http://pastie.caboo.se/84215.txt
  3. patch -p0 < 84215.txt
  4. 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
  5. sudo make
  6. sudo make install
  7. 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 install_nginx_start_script
  • 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.

Advertisements
Leave a comment

3 Comments

  1. Dave

     /  August 15, 2007

    [root@linux04 nginx-0.6.6]# patch -p0 < 84215.txt
    patching file auto/install
    patch unexpectedly ends in middle of line
    Hunk #1 succeeded at 34 with fuzz 1.

    Any ideas? text file looks okay.

  2. Matthew King

     /  August 15, 2007

    I had the same problem when I tried copying and pasting directly from pastie, but I thought I was able to get it working with the downloaded text file.

    If all else fails, you can grab the patch from the mailing list message and replace the weird at tags with @@s.

  3. Matthew King

     /  August 15, 2007

    Seconds after posting my last comment, I see in the nginx mailing list that 0.6.7 is available.

    I haven’t tested, but I think capserverext should work again.

    Changes with nginx 0.6.7 15 Aug 2007

    *) Change: now the paths specified in the “include”,
    “auth_basic_user_file”, “perl_modules”, “ssl_certificate”,
    “ssl_certificate_key”, and “ssl_client_certificate” directives are
    relative to directory of nginx configuration file nginx.conf, but no
    to nginx prefix directory.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: