#server {
#       listen      80 default_server ;
#       server_name "";
#       return      444;
#}

server {
        listen 80 default_server ;
        server_name _; # NAZWA DOMENY

        pagespeed on;

        pagespeed Disallow "*/wp-admin/*";
        pagespeed Disallow "*/admin/*";
        pagespeed Disallow "*/mysql/*";
        pagespeed Disallow "*/wp-login.php";

        index index.php;

        root /home/www/public_html/wordpress/;
        charset utf-8;
        gzip_vary on;
        rewrite "^(.*)\.[\d]{10}\.(css|js)$" $1.$2 last;

        ## WORDPRESS REWRITES ##
        location / {
        try_files $uri $uri/ /index.php?$args;
        }

	add_header X-Frame-Options "SAMEORIGIN";
	add_header X-UA-Compatible "IE=Edge,chrome=1";
	add_header X-Your-Port-Header-Here $server_port;
	add_header X-Your-Protocol-Header-Here $scheme;

        #location = /xmlrpc.php { deny all; }
        location ~* \.(?:manifest|appcache|html?|xml|json)$ {
        expires -1;
        }

        location ~* \.(?:rss|atom)$ {
        expires 1h;
        add_header Cache-Control "public";
        }

        location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
        expires 1d;
        access_log off;
        add_header Cache-Control "public";
        }

        location ~* \.(?:css|js)$ {
        expires 1d;
        access_log off;
        add_header Cache-Control "public";
        }
        location = /favicon.ico {
        expires 1y;
        log_not_found off;
        access_log off;
        }
        location ~ /.well-known {
                allow all;
        }

        location ~ /\. {
        deny all;
        }
        location ~* /uploads/.*\.php$ {
        deny all;
        }
        location ~* /files/.*\.php$ {
        deny all;
        }
        location ~* /akismet/.*\.php$ {
        allow 127.0.0.1;
        deny all;
        }
        location /wp-content/cache/ {
        deny all;
        }

        # STATUS NGINX
        #location /nginxstatus { stub_status; }
        include /etc/nginx/vts.conf;

	# GooglePagespeed Panel
	include /etc/nginx/ps_auth.conf;

	# NO-LOG STATICFILE
        include /etc/nginx/staticfiles.conf;

        # PHP 7

	location ~ \.php$ {
        fastcgi_index index.php;
        fastcgi_pass unix:/run/php/php7.0-fpm-wordpress.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;

        }
        location ~ /purge(/.*) {
        fastcgi_cache_purge www "$scheme$request_method$host$1";
        access_log off;
        }



}
