Sunday, 8 January 2012

How do I install my Nginx with Passenger

While there are pretty much use to run a project in standalone Passenger I'd rather run it with the web server of the production environment. My choice is Nginx. Not because of it's high load speed as I do not (yet) run any high visited websites or loaded applications, but I have found it's configuration simpler then Apache's. Yes, not modular, you cannot enable, disable some things in runtime, but hey I do not really need that either.

So basically I download the nginx source, extract it somewhere. Install the passenger gem. Then run this command:

rvmsudo passenger-install-nginx-module

If it finds every package installed - note that you might need libpcre3 and libpcre3-dev packages too on Ubuntu - then I choose the option 2 which will let me configure nginx further. When it asks for the extra arguments for configure I use these:

--prefix=/etc/nginx --user=www-data --group=www-data --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx/ --lock-path=/var/lock/nginx.lock --with-cpu-opt=amd64 --without-http_userid_module --without-http_upstream_ip_hash_module --without-http_ssi_module --without-http_split_clients_module --without-http_scgi_module --without-http_proxy_module --without-http_geo_module --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --with-http_gzip_static_module --with-http_ssl_module --without-http_browser_module --without-http_limit_req_module --without-http_limit_zone_module --without-http_map_module --without-http_memcached_module --without-http_referer_module

Note I have --with-cpu-opt=amd64 enabled as my virtual machine can use my CPU directly, which is now a AMD Phenom X6.

All done, let the compilation begin! When it's finished we are good to go to use nginx by it's command.

If you have questions feel free to ask in a comment!

No comments:

Post a Comment