Skip to content

Instantly share code, notes, and snippets.

@rjmackay
Created October 7, 2012 05:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save rjmackay/3847180 to your computer and use it in GitHub Desktop.
Save rjmackay/3847180 to your computer and use it in GitHub Desktop.
Example Ushahidi nginx vhost config
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;
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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment