Apache to nginx in 90 seconds

I spent about 30 minutes last night and switched all of my personal sites over to nginx, including the one you are on now and FreeMyFeed. Okay, so I know 30 minutes does not equal 90 seconds, but the title sounded more catching. The configuration for a secured, working nginx instance is quite small. On top of that, configuring virtual hosts is really easy.

The largest amount of time it took to get this finished was recreating the rewrite rules for Zenphoto. The rewrite rules can be found here. I haven’t tested all of the rewrite rules yet, but from quickly browsing through my gallery everything appears to be working well. Keep in mind that these rewrite rules were designed for a site where Zenphoto lives in the root. If it lives in a subfolder the rewrite rules will need to be modified accordingly. I can probably help if you ask nicely.

I have also moved over numerous WordPress sites to nginx. I won’t post their rewrite configurations here because you can find them easily using Google.

You can find the nginx rpms for EL4/EL5 in the Fedora Project’s EPEL repo.

If you have any nginx related configuration questions feel free to ask, I’m getting pretty familiar with the app.

About Matt

IF YOU REALLY want to hear about it, the first thing you'll probably want to know is where I was born, and what my lousy childhood was like, and how my parents were occupied and all before they had me, and all that David Copperfield kind of crap, but I don't feel like going into it, if you want to know the truth.

In any case I am employed as a Senior Linux Systems Engineer at Rackspace in San Antonio, TX.

I spent the majority of my college years as an Astrophysics major specializing in black holes. When I got to my senior year and was studying 40 hours a week to stay on track I decided to bail and pursue an easier career.

I spend the majority of my time now contributing to WordPress, developing WordPress plugins, helping out in the WordPress IRC Channel, playing football (not American!), practicing Krav Maga, and last but not least, spending time with my Wife and Son.

This entry was posted in CoolStuff, Linux, Technology. Bookmark the permalink.

One Response to Apache to nginx in 90 seconds

  1. Alfred says:

    Hi,

    I’ve got a Sweetcron (sweetcron.com) install running with nginx.

    The standard sweetcron .htaccess look like this:

    Options +FollowSymLinks
    RewriteEngine On

    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]

    My /etc/nginx/sites-enabled/nerstu.se look like this:

    server {
    listen 80;
    server_name http://www.nerstu.se;
    rewrite ^/(.*) http://nerstu.se/$1 permanent;
    }

    server {
    listen 80;
    server_name nerstu.se;
    client_max_body_size 2m;

    access_log /home/a83/public_html/nerstu.se/log/access.log;
    error_log /home/a83/public_html/nerstu.se/log/error.log;

    location / {
    root /home/a83/public_html/nerstu.se/public/;
    index index.php;
    }

    # .php and .php5 sent to php5
    location ~ .*\.php[345]?$ {
    include /etc/nginx/fcgi.conf;
    fastcgi_pass 127.0.0.1:10005;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME
    /home/a83/public_html/nerstu.se/public$fastcgi_script_name;
    }
    }

    Do you know how I can make it work? I tried a lot of different sollutions without any luck. Thanks in advance!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre>