Hello Nginx

| | [C]olor

I've used apache for the first two years of my blog. But today I switched to nginx because I wanted to try a new server and because nginx seems to play well with RoR apps. For comparison this is my nginx server configuration (SSL config omitted):

# nginx.conf
server {
    listen 80;
    listen [::]:80;

    set $root_dir '/var/www/html/sergioro.mx';

    server_name sergioro.mx www.sergioro.mx;
    root $root_dir/_site;
    index index.html index.htm;

    access_log /var/www/html/sergioro.mx/access.log sergio_format;
    error_log /var/www/html/sergioro.mx/error.log info;

    location / {
        try_files $uri $uri/ =404;

and my apache configuration:

# apache.conf
<VirtualHost *:80>
    Define RootDir /var/www/html/sergioro.mx

    ServerName sergioro.mx
    ServerAlias www.sergioro.mx
    DocumentRoot ${RootDir}/_site
    DirectoryIndex index index.html index.htm;

    CustomLog ${RootDir}/access.log sergio_format
    ErrorLog ${RootDir}/error.log info

    ErrorDocument 404 /404.html
    ErrorDocument 403 /404.html

Both configs are very similar but I have a slight preference for nginx syntax: - scope {...} instead of <scope>...</scope> for context blocks. - $var instead of ${var} for variables.

Things I wish nginx had: - man pages for every module, with a description of each directive. - support for variables in error_log and access_log directives.

I can't wait to try out Nginx reverse proxy and load balancing!