Tags: nginx

Sort by: Date / Title /

  1. 7 years ago by spirit
    1. # htpasswd file is relative to nginx conf
    2. location  /  {
    3.   auth_basic            "Restricted";
    4.   auth_basic_user_file  conf/htpasswd;
    5. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2061"></script>
  2. 7 years ago by spirit
    1. # Nginx status
    2. server {
    3.   listen 80;
    4.   server_name localhost;
    5.   location /nginx_status {
    6.     stub_status on;
    7.     access_log off;
    8.     allow 127.0.0.1;
    9.     deny all;
    10.   }   
    11. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2023"></script>
  3. 7 years ago by spirit
    if ($request_uri ~* "\.(ico|css|js|gif|jpe?g|png)\?[0-9]+$") {
      access_log off;
      expires 31d;
      break;
    }
    # Matching URLs
    http://domain.com/stylesheets/blog.css?1221178271
    
    if ($request_uri ~* "\.(ico|gif|png|jpe?g|css|js|swf)(\?v\d\d?)?$") {
      access_log off;
      expires 31d;
      break;
    }
    # Matching URLs
    http://domain.com/stylesheets/blog.css
    http://domain.com/stylesheets/blog.css?v1
    http://domain.com/stylesheets/blog.css?v12
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2021"></script>
  4. sponsorised links
  5. 7 years ago by spirit
    1. ## Only allow these request methods
    2. if ($request_method !~ ^(GET|HEAD|POST)$ ) {
    3.     return 444;
    4. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2019"></script>
  6. 7 years ago by spirit
    1. location = /favicon.ico {
    2.     access_log off;
    3.     return 204;
    4.     # or empty_gif;
    5. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2018"></script>
  7. 7 years ago by spirit
    server {
        server_name mysite.tld ~^.+.mysite.tld$;
    
        map $host $files {
            default            common;
            mysite.tld         common;
            www.mysite.tld     common;
            admin.mysite.tld   admin;
            system.mysite.tld  system;
            *.mysite.tld       users;
        }
        root /var/www/mysite/$files;
    }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2017"></script>
  8. 7 years ago by spirit
    1. server {
    2.     listen 80;
    3.     listen 443 default ssl;
    4.  
    5.     # other directives
    6. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2016"></script>
  9. 7 years ago by spirit
    location ~ /.svn/* {
        deny  all;
    }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2009"></script>
  10. 7 years ago by spirit
    1. # Add this line to your "vhost"
    2.  
    3. fastcgi_param DEBUG "uri=$uri request_uri=$request_uri
    4.                                   request_filename=$request_filename query_string=$query_string is_args=
    5.                                   $is_args document_uri=$document_uri document_root=$document_root args=
    6.                                   $args fastcgi_script_name=$fastcgi_script_name path_info=$path_info script=$script";
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2007"></script>
  11. 7 years ago by spirit
    1. # Add the file /etc/logrotate.d/nginx with the following content:
    2. /path/to/log/nginx_* {
    3.     missingok
    4.     notifempty
    5.     compress
    6.     sharedscripts
    7.     postrotate
    8.         test ! -f /var/run/nginx.pid || kill -USR1 `cat /var/run/nginx.pid`
    9.     endscript 
    10. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/1999"></script>

First / Previous / Next / Last / Page 1 of 1 (10 posteets)