Vanilla Forum 2.1 Nginx Configuration

Are you already loosing you hair trying to configure your vanilla forum url-rewrite on NGINX?

If your forum is installed on a main domain not a subdomain I might have the solution for you. here’s what got, please let me know if it works for you…

server {
    listen       80;
    root   /usr/share/nginx/youvanilladirectory/;
    #access_log /usr/share/nginx/youvanilladirectory/access.log;
    access_log off;
    #error_log /usr/share/nginx/youvanilladirectory/error.log;
    error_log off;
    index  index.php index.html index.htm;
    #Root location
    location ^~ /discussion/download/ { rewrite ^/(.+)$ /index.php?p=$1 last;}
    location ^~ /utility/thumbnail/ { rewrite ^/(.+)$ /index.php?p=$1 last;}
    location / {
        try_files $uri $uri/ @forum;
    # Rewrite to prettify the URL and hide the ugly PHP stuff
    # Start with this commented out until you configure it in Vanilla!
    location @forum {
        rewrite ^/(.+)$ /index.php?p=$1 last;
    location ~ \.php$ {
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    location ~* \.(js|css|png|jpg|jpeg|gif|ico)(\?ver=[0-9.]+)?$ {
        expires 1y;