server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /app/www;
    index index.html index.php;

    # Upload size
    client_max_body_size 32M;

    # Make site accessible from http://localhost/
    server_name localhost;

    location /assets/css/bundle.css {
		if ($host = cockpit.la) {
			rewrite ^/(.*)$ /assets/cockpit/css/bundle.css break;
		}
		if ($host != cockpit.la) {
        	rewrite ^/(.*)$ /assets/css/bundle.css break;
		}
    }

    location /assets/js/bundle.js {
		if ($host = cockpit.la) {
			rewrite ^/(.*)$ /assets/cockpit/js/bundle.js break;
		}
		if ($host != cockpit.la) {
        	rewrite ^/(.*)$ /assets/js/bundle.js break;
		}
    }

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini

        fastcgi_pass 127.0.0.1:9000;
		#fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_index index.php;
        include fastcgi_params;
    }

}
