Skip to content

Instantly share code, notes, and snippets.

@JoaoVagner
Created February 19, 2015 21:22
Show Gist options
  • Save JoaoVagner/d5bf71e103775bcaff8b to your computer and use it in GitHub Desktop.
Save JoaoVagner/d5bf71e103775bcaff8b to your computer and use it in GitHub Desktop.
server {
listen 80;
server_name _;
root /var/www/html/dashboard-rivendel/public;
index index.php;
access_log /var/log/nginx/access-painel.log;
error_log /var/log/nginx/error-painel.log;
location / {
root /var/www/html/dashboard-rivendel/public/;
index index.html index.php;
try_files $uri /index.php?$uri&$args;
#try_files $uri $uri/ /index.php;
}
# Set expires max on static file types
location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm)$ {
expires max;
root /var/www/html/dashboard-rivendel/public;
access_log off;
}
# opt-in to the future
add_header "X-UA-Compatible" "IE=Edge,chrome=1";
# Only allow these request methods
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}
# Do not accept DELETE, SEARCH and other methods
# Block download agents
if ($http_user_agent ~* LWP::Simple|BBBike|wget) {
return 403;
}
# Block some robots
if ($http_user_agent ~* msnbot|scrapbot) {
return 403;
}
# Deny certain Referers
if ( $http_referer ~* (babes|forsale|girl|jewelry|love|nudit|organic|poker|porn|sex|teen) ) {
return 403;
}
location ~ \.php$ {
root /var/www/html/dashboard-rivendel/public;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html/dashboard-rivendel/public$fastcgi_script_name;
fastcgi_param FUEL_ENV development;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment