Entries tagged “nginx”

nginx proxying to apache

I gave up on fastcgi with NginX and django. Too many things just didn’t work, so I decided to keep Apache, but lock it down and thrown NginX in the front to serve static content and to prevent max client issues.

Read full post
Keep a second web server around for luck...

I had one of those mid-day “what’s going on with my server” heart-atacks. I have a service that emails me when reviewsby.us is down. On my old server if it went down, I could just restart the server and it’d be back up. That was big old apache, running out of memory or something.

Reviewsby.us is a medium sized site. It gets a fair amount of traffic at a steady pace. Even in this case I decided I was in need for a new server, so I looked into nginx. It’s fast and it can serve static content well and pass things to fastcgi. Joshua Schachter explains the proxy in front concept pretty well.

Back to my web developer heart attack…

Well this setup had been holding up for a better part of a month fairly well… then I saw that a lot of the pages just lagged. I restarted fastcgi and nginx (it was a fastcgi issue). Rather than try to debug something I couldn’t, I quickly installed apache2 and setup the server the tried and tested way.

This all took place in a half an hour. Not the end of the world, but not elegant either. In the future, I’ll revert to using nginx (possibly nginx+apache versus nginx+fastcgi) but I’ll keep my other configurations around when all hell breaks loose.

Read full post
Fixing broken PATH_INFO

[tags]php, cgi, path_info, nginx, symfony[/tags]

symfony and other applications rely on the server’s PATH_INFO being set properly. According to NCSA:

The extra path information, as given by the client. In other words, scripts can be accessed by their virtual pathname, followed by extra information at the end of this path. The extra information is sent as `PATH_INFO`. This information *should be decoded by the server* if it comes from a URL before it is passed to the CGI script.

Unfortunately, I use a nonstandard server that doesn’t natively support CGI, so everything sent to the FastCGI server is done so via parameters that are usually obtained from the HTTP request, but I can’t figure out how to do a urldecode in my configuration.

So to workaround this I used the auto_prepend_file directive in php.ini. With OP code caching this shouldn’t hurt too much:

auto_prepend_file = /var/www/pathinfofix.php

I then added the following script:


Voila, the PATH_INFO is in a format that symfony (and any other PHP script that depends on PATH_INFO) needs.

Read full post
nginx and symfony

[tags]nginx, server, symfony[/tags]

Read full post
nginx and 'www' free urls

[tags]nginx, rewrite[/tags]

Read full post