FAQ

Page Discussion History

Difference between revisions of "OnOpenBSD"

m (Oops)
(More code tag fixes)
 
Line 66: Line 66:
 
== Shutting down nginx ==
 
== Shutting down nginx ==
 
<pre>
 
<pre>
$ sudo kill -QUIT <code>cat /var/run/nginx.pid</code>
+
$ sudo kill -QUIT $(cat /var/run/nginx.pid)
 
</pre>
 
</pre>
  

Latest revision as of 03:05, 17 February 2012

Contents

Installing and configuring Nginx / Mongrel on OpenBSD with Rails support.

Install the PCRE library

It is advised you be familiar with installing packages on OpenBSD before proceeding. You can find OpenBSD's package documentation here.

$ sudo pkg_add -v pcre

Download and extract the nginx sources

Make sure to appropriately substitute the version numbers below:

$ wget http://sysoev.ru/nginx/nginx-X.X.XX.tar.gz
$ tar -xzvf nginx-X.X.XX.tar.gz

Configure the Makefile

$ cd nginx-X.X.XX/
$ ./configure --sbin-path=/usr/local/sbin/nginx \
              --conf-path=/etc/nginx/nginx.conf \
              --pid-path=/var/run/nginx.pid \
              --with-http_ssl_module \ 
              --http-log-path=/var/log/nginx.log \ 
              --error-log-path=/var/log/nginx-error.log \ 
              --http-fastcgi-temp-path=/var/tmp/fastcgi_tmp \ 
              --http-proxy-temp-path=/var/tmp/proxy_tmp \ 
              --http-client-body-temp-path=/var/tmp/client_body_temp \ 
              --with-http_stub_status_module \ 
              --user=www --group=www

Compile and install

$ make && sudo make install

After nginx has been installed, make sure to edit /etc/nginx/nginx.conf according to your needs.

Log files

By default, nginx saves its logs as /var/log/nginx.log and /var/log/nginx-error.log. You may wish to configure nginx so that it saves its logs on a per-host basis.

Initializing Mongrel Cluster from your path/to/app/rails/

You can take the sample nginx.conf file from http://wiki.codemongers.com/NginxRubyonRailsMongrel and adjusting it to app

$ cd /var/www/rails_app/
$ sudo mongrel_rails cluster::configure 
$ sudo mongrel_rails cluster::start

Starting nginx

$ sudo /usr/local/sbin/nginx

Testing, appoint your browser to rails app (localhost, default here)

$ lynx http://localhost

Restarting nginx

$ sudo kill -HUP $(head -1 /var/run/nginx.pid)

Shutting down nginx

$ sudo kill -QUIT $(cat /var/run/nginx.pid)

Final notes

The initial motivation for this article was a rapid introduction to install and setup nginx on OpenBSD. Currently exist a port under /usr/ports/www/nginx. It can be the best way to install and handle new nginx versions on this Operating System.

Whenever it article is nice and functional.