# This file is contributed by Eugene MechanisM
# Link to the post:
# http://forum.sourcefabric.org/discussion/13563/first-step-to-run-airtime-via-nginx-based-on-airtime-2.0-beta-files

upstream php5-fpm {
        ip_hash;
        server unix:/var/run/airtime.php.sock;
}
server {
	        listen               80;
	        server_name          airtime; #change to your host
	        include              mime.types;
                root                 /usr/share/airtime/public;
                access_log           /var/log/airtime.access.log;
                error_log            /var/log/airtime.error.log;
                index                index.php;
	        include              fastcgi_params;
                client_max_body_size 1G;

                location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm)$ {
                expires max;
                access_log off;
                add_header Pragma public;
		add_header Cache-Control "public, must-revalidate, proxy-revalidate";
                }
                location / {
                        if (-e $request_filename){
	                   set $rule_0 1;
                        }
                        if ($request_filename ~ "-l"){
	                   set $rule_0 1;
                        }
                        if (-d $request_filename){
	                   set $rule_0 1;
                        }
                        rewrite ^/.*$ /index.php last;
			try_files $uri $uri/ index.php;
                        
                }
                location ~ \.php$ {
                        include fastcgi_params;
                        fastcgi_pass php5-fpm;
                }
		location = /favicon.ico {
                        log_not_found off;
			access_log off;
                }
                location = /robots.txt {
			allow all;
			log_not_found off;
			access_log off;
		}
                location ~ /\.ht {
                        deny all;
                }
}