Skip to content

Instantly share code, notes, and snippets.

@ItsAdventureTime
Forked from ghalusa/default
Created April 12, 2016 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ItsAdventureTime/cfb414f444638080fff5cb971722215d to your computer and use it in GitHub Desktop.
Save ItsAdventureTime/cfb414f444638080fff5cb971722215d to your computer and use it in GitHub Desktop.
nginx default configuration file (ubuntu path: /etc/nginx/sites-available/default) with conversions of .htaccess environment variables and mod_rewrite logic, along with parameters supporting a fastcgi-based php setup
server {
listen 80;
root /var/www/YOUR_DIRECTORY;
index index.php index.html index.htm;
###################################################
# Change "yoururl.com" to your host name
server_name yoururl.com;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location /site/ {
if (!-e $request_filename){
rewrite ^/site/(.*)$ /site/index.php break;
}
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param PATH_TO_FRAMEWORKS /var/www/frameworks/;
fastcgi_param CORE_TYPE frameworks;
fastcgi_param IS_DEV true;
include fastcgi_params;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ /\. {
deny all;
}
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment