Skip to content

Instantly share code, notes, and snippets.

@steppefox
Created November 21, 2013 20:36
Show Gist options
  • Save steppefox/7589145 to your computer and use it in GitHub Desktop.
Save steppefox/7589145 to your computer and use it in GitHub Desktop.
LINUX Nginx configurating
  • HTTP Authorization in NGINX
location /admin/ {
    auth_basic "Admin Zone";
    auth_basic_user_file /var/www/example.com/admin/.htpasswd;
}
  • Request Entity Too large
client_max_body_size 10m;
  • Basic configuration
server{
  listen 80;
  server_name ~^(?<nginxhateyou>[\w]+\.steppefox)$;
  root /home/steppefox/www/steppefox;
}

charset utf-8;
location / {
    index index.html index.php;
    try_files $uri $uri/ /index.php?$args;
}
location ~ ^/(protected|framework|themes/\w+/views) {
    deny  all;
}
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
    try_files $uri =404;
}
location ~ \.php {
    fastcgi_split_path_info  ^(.+\.php)(.*)$;
    set $fsn /index.php;
    if (-f $document_root$fastcgi_script_name){
        set $fsn $fastcgi_script_name;
    }
    fastcgi_pass   127.0.0.1:9000;
    include fastcgi_params;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fsn;
    fastcgi_param  PATH_INFO        $fastcgi_path_info;
    fastcgi_param  PATH_TRANSLATED  $document_root$fsn;
}
location ~ /\.ht {
    deny  all;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment