jhejlik
4/22/2018 - 8:06 AM

lock Pagekit on NginX

server {
	listen 80;
	#listen 443 ssl http2;
	server_name devel.mageek.cz;
	root /home/mageek/devel.mageek.cz;
	index index.html index.php;
	access_log /home/mageek/devel.mageek.cz.access.log;
	error_log /home/mageek/devel.mageek.cz.error.log;

	#include snippets/ssl.conf;
	#ssl_certificate /etc/nginx/ssl/domain.tld.crt;
	#ssl_certificate_key /etc/nginx/ssl/domain.tld.key;

	include bots.d/blockbots.conf; # nginx ultimate badbot blocker
	include bots.d/ddos.conf; # nginx ultimate badbot blocker
	
	server_name_in_redirect off;
	charset utf-8;
	sendfile off;
	client_max_body_size 100m;

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

	location = /favicon.ico {
		access_log  off;
		log_not_found  off;
	}

	location = /robots.txt {
		access_log  off;
		log_not_found  off;
	}

	location ~ \.php$ {
		fastcgi_split_path_info  ^(.+\.php)(/.+)$;
		include snippets/fastcgi-php.conf;
		#fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
		fastcgi_pass unix:/var/run/php/php7.0-fpm-mageek.sock; # only with custom fpm pool
		fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
		fastcgi_param  HTTP_MOD_REWRITE On;
		fastcgi_intercept_errors  off;
	}

	location ~ \.(js|css|png|jpg|jpeg|gif|ico|html|woff|ttf|svg|eot|otf)$ {
		add_header "Access-Control-Allow-Origin" "*";
		expires 30d;
		access_log off;
		add_header Cache-Control "public";
	}

	location ~ /\.ht {
		deny all;
	}

	location ~ /(composer.lock|pagekit.db|installed.json|composer.json|package.json|bower.json|CHANGELOG.md|README.md|gulpfile.js|webpack.config.js|pagekit) {
		deny all;
	}
}