Skip to content

Instantly share code, notes, and snippets.

@raedatoui
Created December 7, 2012 19:39
Show Gist options
  • Save raedatoui/4235893 to your computer and use it in GitHub Desktop.
Save raedatoui/4235893 to your computer and use it in GitHub Desktop.

Revisions

  1. raedatoui revised this gist Dec 7, 2012. 1 changed file with 0 additions and 6 deletions.
    6 changes: 0 additions & 6 deletions nginx_config
    Original file line number Diff line number Diff line change
    @@ -19,8 +19,6 @@ server {
    }


    #location ~ ^/404|bios|oldie|oldff|admin|assets|callouts|trails|pois|poi_type|facebook|parks|uploads|trailview|grand-canyon|smoky-mountains|yellow-stone|what/(.*)$ {
    #location ~ ^/(.*)$ {
    location / {
    root /usr/local/nature-valley/current/public;

    @@ -43,8 +41,4 @@ server {
    break;
    }
    }
    #location / {
    # root /usr/local/nature-valley/shared;
    # auth_basic off;
    #}
    }
  2. raedatoui created this gist Dec 7, 2012.
    50 changes: 50 additions & 0 deletions nginx_config
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    upstream unicorn_production {
    server unix:/usr/local/nature-valley/current/tmp/sockets/unicorn.sock;
    }

    server {
    listen 80;
    server_name "Name of the server";
    access_log /var/log/nginx/nv.log;
    error_log /var/log/nginx/nv.error.log;
    root "public directory of Rails App;
    index index.html;

    if ($http_user_agent = "-" ) {
    return 403;
    }

    if ($http_user_agent = "" ) {
    return 403;
    }


    #location ~ ^/404|bios|oldie|oldff|admin|assets|callouts|trails|pois|poi_type|facebook|parks|uploads|trailview|grand-canyon|smoky-mountains|yellow-stone|what/(.*)$ {
    #location ~ ^/(.*)$ {
    location / {
    root /usr/local/nature-valley/current/public;

    #auth_basic "Restricted";
    #auth_basic_user_file /etc/nginx/htpasswd;

    client_max_body_size 100M;
    client_body_buffer_size 1M;

    #proxy_pass_header X-Accel-Redirect;
    proxy_pass_header Set-Cookie;
    proxy_pass_header P3P;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    if (!-f $request_filename) {
    proxy_pass http://unicorn_production;
    break;
    }
    }
    #location / {
    # root /usr/local/nature-valley/shared;
    # auth_basic off;
    #}
    }