Good Nginx reverse proxy tutorial

Events happening in the community are now at Drupal community events on www.drupal.org.
jasmineah's picture

i am currently trying to install nginx as a reverse proxy on an apache2 debian squeeze server. I tried using nginx on its own but kept facing problems so i decided to use apache as am more familiar with it. Is there a good recent tutorial i can follow? the pressflow7 site will have a lot of images. Thanks in advance.

Comments

I've just found a tutorial

jasmineah's picture

I've just found a tutorial here - http://hartlessbydesign.com/blog/view/206-virtualmin-apache-and-nginx-re... but am not sure if this is the right way to do it for drupal. Yes i am using virtual min.

That config

perusio's picture

is a bit "old". Also note that they're not using Nginx the proxy to serve static files, but are using another upstream. No need to do that. The proxy can serve static files with no problem. Unless of course you really need/want a dedicated static file server.

You'll need it if you want to cache static files using the Nginx cache, for example.

You can take most of the Apache stuff in terms of mod_rpaf config.

The keepalive timeouts are too big and the gzip disable for MSIE6 is outdated. There's a better way to do it.

Thank you for the reply. Do

jasmineah's picture

Thank you for the reply. Do you happen to know where I can find a recent tutorial and nginx config files? Cheers.

I do

perusio's picture

but I'm biased ;)

Check the group header.

Note also

perusio's picture

I have 0 experience with virtualmin. Panels introduce another level of indirection, IMHO, they make managing your server less transparent.

Lol I noticed but I trust you

jasmineah's picture

Lol I noticed but I trust you would give the right advice given you have a lot of experience with nginx. So if I decided to follow the tutorial, which config files can I use from your github repo? I mean the config which will be beneficial for Drupal?

Well

perusio's picture

there's some remarks on the README for that:

Nginx as a Reverse Proxy: Proxying to Apache for PHP

There's an upstream_phpapache.conf.

Thanks, will have a look

jasmineah's picture

Thanks, will have a look

Nginx Upload Progress Module

jasmineah's picture

Hi Perusio, I ended up installing nginx as the main webserver and removed apache. I included all your config files, except those in sites-available as i've not hosted any sites yet. So far the only problem i've faced is installing the upload progress module. I have followed these steps -

$ wget http://nginx.org/download/nginx-1.2.0.tar.gz

downloaded and uploaded via sftp - https://github.com/masterzen/nginx-upload-progress-module/tarball/v0.9.0

$ cd nginx-1.2.0

$ ./configure --add-module=/usr/local/src/masterzen-nginx-upload-progress-module-a788dea

$ make

$ make install

I checked whether the module had been installed using $ nginx –V and there was no line about the module. Any idea how i can get this to work. the current config only works because i commented the upload progress line in nginx.conf.

Does the module

perusio's picture

goes by on the compilation process and configure phase.

Thanks for the speedy reply.

jasmineah's picture

Thanks for the speedy reply. I have downloaded the modules (listed in your makefile) and placed them inside the nginx-1.2.0 folder, in a new folder I named modules. Now comes the part I need help with.

Should i replace the code in the file with the one in your makefile (ie my Debian rules file) then run -$ ./configure After I run aptitude remove nginx?

OR

Should i run aptitude remove nginx and the the following -

./configure --conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--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 \
--http-scgi-temp-path=/var/lib/nginx/scgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
--lock-path=/var/lock/nginx.lock \
--pid-path=/var/run/nginx.pid \
--with-debug \
         --without-mail_pop3_module \
--without-mail_imap_module \
--without-mail_smtp_module \
--with-http_flv_module \
--with-http_geoip_module \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_sub_module \
--with-ipv6 \
         --with-file-aio \
--with-http_secure_link_module \
--with-http_mp4_module \
         --with-http_image_filter_module \
--add-module=/modules/nginx-upstream-fair \
--add-module=/modules/nginx-upload-progress-module \
--add-module=/modules/lua-nginx-module \
--add-module=/modules/nginx-auth-request-module \
--add-module=/modules/nginx-sticky-module \

Sorted

jasmineah's picture

All sorted now. I removed nginx completely and added the dotdeb repos. having done that i ran an update and installed nginx-extras (aptitude install nginx-extras) and it installed all the modules i wanted to install.

Hope this helps someone.

Nginx

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: