Skip to content

Instantly share code, notes, and snippets.

@tungd
Forked from DarrylDias/pagekit.conf
Last active May 25, 2017 03:36
Show Gist options
  • Save tungd/82dac752ec1f935747d7c9ef1a9e1eb7 to your computer and use it in GitHub Desktop.
Save tungd/82dac752ec1f935747d7c9ef1a9e1eb7 to your computer and use it in GitHub Desktop.
NGINX config for PageKit. (Tested on Debian 8)
server {
listen 80;
listen [::]:80;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
root /var/www/justnofap.club;
# Add index.php to the list if you are using PHP
index index.php index.html;
server_name www.justnofap.club;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location ~* /(packages|storage|tmp)/.php$ {
return 403;
}
# Deny access to files with the following extensions
location ~* \.(db|json|lock|dist|md)$ {
return 403;
}
# Deny access to following files
location ~ ^/(config.php|pagekit|composer.lock|composer.json|LICENSE|\.htaccess) {
return 403;
}
# Leverage browser caching of media files for 30 days
location ~* \.(?:ico|css|js|gif|jpe?g|png|svg|ttf|woff)$ {
access_log off;
expires 30d;
add_header Pragma public;
add_header Cache-Control "public, mustrevalidate, proxy-revalidate";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment