Skip to content

Instantly share code, notes, and snippets.

@oc
Created May 27, 2013 16:35
Show Gist options
  • Save oc/5657978 to your computer and use it in GitHub Desktop.
Save oc/5657978 to your computer and use it in GitHub Desktop.
Hrrmrm..
server {
server_name www.example.com;
rewrite ^ http://example.com$request_uri? permanent;
}
upstream php-example-com-backend {
server unix:/var/run/php5-fpm.sock;
}
server {
server_name example.com;
client_max_body_size 10m;
root /srv/www/example.com;
access_log /var/log/nginx/example.com.access.log;
keepalive_timeout 5;
location = /robots.txt {
access_log off;
log_not_found off;
}
location = /favicon.ico {
expires 3M;
access_log off;
log_not_found off;
}
location ~* \.(jpg|jpeg|gif|css|png|js|ico)$ {
access_log off;
expires 30d;
}
location / {
auth_basic "example.com Protected Area";
auth_basic_user_file /etc/nginx/ext/htpasswd-example.com;
index index.php;
}
location ~ \.php$ {
fastcgi_pass php-example-com-backend;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/example.com$fastcgi_script_name;
include fastcgi_params;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort off;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment