Do I really need to use Nginx as reverse proxy to Apache ???

Do you think it's really advisable to use Nginx as a reverse proxy to serve static files and have Apache handle all of the dynamic content?

I've experimented with using stand-alone Nginx - although not extensively - and everything seemed to go swimmingly. Not having tried the reverse proxy method I really can't compare. I'm thinking perhaps the many post I've encountered suggesting this proxy setup may be outdated.

11 Replies

No, just use Apache. These are just tweakers suggesting the use of another webserver.

I use Lighttpd, you insensitive clod.

Although, Lighttpd alone, so if I used nginx, it'd be nginx alone.

im using nginx alone with php as fastcgi

so I have MySQL+nginx+PHP with wordpress+phpbb running

and I have only ~40mb of memory used with 320mb free on my linode360

I'm setting up a new server, and I'm very tempted to use nginx alone, but I just can't find all the documentation I need to set up all the pieces: php, https, virtual hosts. That's not mentioning the rewrite rules that packages assume will be translated by Apache.

There are some hackish how-tos out there, but it's hard to take nginx seriously as a standalone server when the recommended method for installing php support requires installing lighttpd. The other favorite method involves recompiling php. Sorry, nginx, come back when you've grown up.

One important criterion for me is to be able to keep my system patched with my Linux distribution's package manager. While nginx has a lot of mindshare among vps experimenters, the distro packagers haven't yet made nginx easy to patch or configure.

I'd still like to use nginx as a reverse proxy for static files, passing only php requests to Apache. I haven't found a simple recipe even for that, though. The nginx fans don't seem to want to share any requests with Apache, but would rather let nginx handle php by itself. So I'm taking the path of least resistance and sticking with Apache alone. If traffic warrants, I'll put on my hip boots and try again to set nginx up as a reverse proxy.

When my distro's package manager knows how to set up phpmyadmin using nginx as the webserver, and keep the whole thing updated, then I may be ready to dump Apache.

try this for your nginx config.

http://gist.github.com/222562

apache should be on port 8080 substitute in your hostname and file path.

@H3LR4ZR:

try this for your nginx config.

Thanks for the leg up! I'll give it a try.

Don't go to the hassle of running two http daemons side by side, if you can avoid it. One more daemon is one more point of failure, and one more security/maintenance headache.

Nginx is perfectly capable of running a good website on its own, as long as you can get the rewrite rules to work (much easier than lighttpd IMO) and you don't need Apache-specific techniques (the most common problem being .htaccess configuration directives scattered throughout the document tree). You can use PHP5 FastCGI on its own (you don't need to install lighttpd), or you can take advantage of spawn-fcgi, which has recently been separated from lighttpd. Just download it from its home page && make && make install. But AFAIK Ubuntu 9.10 lets you install spawn-fcgi on its own without having to pull in the entire lighttpd webserver.

On the other hand, Apache is also a very capable server, and it works very well even in a VPS provided that you tell it to make efficient use of RAM. The worker MPM is even better, but it's a bit of a hassle to set up correctly. If you need Apache-specific functionalities and you're not exactly experiencing a shortage of system resources, you don't need to board the nginx/lighttpd/whatever bandwagon.

I'm thinking those out-of-date how-tos are the problem,… because a few months ago I tried installing with the nWeb Script - Easy installer script for Debian / Ubuntu (Installs nginx, with PHP and MySQL) found at http://thehook.eu/tools/nweb/ and everything seemed to work fine-n-dandy -- and if I remember correctly, with fastcgi ready to rock. phpmyadmin slid right in and worked just fine, too.

Maybe Nginix is all grown up, but we just don't know it ???

@rbiffl:

There are some hackish how-tos out there, but it's hard to take nginx seriously as a standalone server when the recommended method for installing php support requires installing lighttpd. The other favorite method involves recompiling php. Sorry, nginx, come back when you've grown up.

while I agree with you that running two http daemons adds more 'moving parts' and thus more points of failure, it works out to be a good solution when users expect to work on apache and won't/can't learn syntax for a new server.

good point H3LR4ZR. so maybe we have two scenarios - 1.) a solution built for users with their various needs and abilities - and 2.) a system built for itself, with in-house admin, etc,… ???

me, i'm just concerned with the later.

@kjb:

I'm thinking those out-of-date how-tos are the problem,… because a few months ago I tried installing with the nWeb Script - Easy installer script for Debian / Ubuntu (Installs nginx, with PHP and MySQL) found at http://thehook.eu/tools/nweb/ and everything seemed to work fine-n-dandy -- and if I remember correctly, with fastcgi ready to rock. phpmyadmin slid right in and worked just fine, too.

This script looks interesting and I'd never heard of it before, so thanks for the pointer. :)

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct