Skip to content

Instantly share code, notes, and snippets.

@rjmackay
Created October 7, 2012 05:08
Show Gist options
  • Select an option

  • Save rjmackay/3847180 to your computer and use it in GitHub Desktop.

Select an option

Save rjmackay/3847180 to your computer and use it in GitHub Desktop.

Revisions

  1. rjmackay revised this gist Oct 7, 2012. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions php.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    fastcgi_split_path_info ^(.*\.php)(.*)$;

    include fastcgi_params;

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param HTTP_HOST $host;
    fastcgi_param SERVER_NAME $host;
    fastcgi_intercept_errors on;
    fastcgi_index index.php;
    fastcgi_pass php_backend;
  2. rjmackay renamed this gist Oct 7, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. rjmackay created this gist Oct 7, 2012.
    109 changes: 109 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,109 @@
    server {
    listen 80;
    server_name ushahidi.standbytaskforce.com www.ushahidi.standbytaskforce.com;

    root /var/www/ushahidi.standbytaskforce.com;
    index index.html;

    open_file_cache max=1000 inactive=20s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 2;
    open_file_cache_errors on;

    proxy_intercept_errors on;

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

    location ^~ /index.php {
    allow all;
    include php.conf;
    break;
    }

    # Deny access to other php scripts.
    location ~* \.php$ {
    deny all;
    break;
    }

    # Deny /application access.
    location ^~ /application {
    deny all;
    break;
    }

    # Deny /modules access.
    location ^~ /modules {
    allow 127.0.0.1;
    deny all;
    break;
    }

    # Deny /system access.
    location ^~ /system {
    deny all;
    break;
    }

    # Deny /sql access.
    location ^~ /sql {
    deny all;
    break;
    }

    # Deny /tests access.
    location ^~ /tests {
    deny all;
    break;
    }

    location = /readme.html {
    deny all;
    break;
    }

    location = /License.txt {
    deny all;
    break;
    }

    # Sanatize /plugin requests.
    location /plugins {
    proxy_cache_methods GET;
    proxy_cache static;
    proxy_cache_valid any 1d;

    proxy_cache_bypass 0;
    proxy_no_cache 0;

    log_not_found off;
    try_files $uri =404;
    expires max;
    break;
    }

    # Sanatize /media requests.
    location /media {
    proxy_cache_methods GET;
    proxy_cache static;
    proxy_cache_valid any 1d;

    proxy_cache_bypass 0;
    proxy_no_cache 0;

    log_not_found off;
    try_files $uri =404;
    expires max;
    break;
    }

    # Sanatize /img requests.
    location /img/ {
    rewrite ^ /media/$request_uri permanent;
    break;
    }

    }