Skip to content

Instantly share code, notes, and snippets.

@miguelramos
Last active January 21, 2017 04:40
Show Gist options
  • Save miguelramos/a2060295525a48ccc3dc to your computer and use it in GitHub Desktop.
Save miguelramos/a2060295525a48ccc3dc to your computer and use it in GitHub Desktop.
Nginx Grav
server {
listen 80;
server_name *.grav.dev;
root /home/www/grav.dev;
index index.html index.htm index.php;
charset utf-8;
location /user {
rewrite ^/user/accounts/(.*)$ /error redirect;
rewrite ^/user/config/(.*)$ /error redirect;
rewrite ^/user/(.*)\.(txt|md|html|php|yaml|json|twig|sh|bat)$ /error redirect;
}
location /cache {
rewrite ^/cache/(.*) /error redirect;
}
location /bin {
rewrite ^/bin/(.*)$ /error redirect;
}
location /system {
rewrite ^/system/(.*)$ /error redirect;
}
location /vendor {
rewrite ^/vendor/(.*)$ /error redirect;
}
# Remember to change 127.0.0.1:9000 to the Ip/port
# you configured php-cgi.exe to run from
access_log off;
error_log /var/log/nginx/grav-error.log error;
sendfile off;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment