Skip to content

Instantly share code, notes, and snippets.

@nesquena
Last active February 28, 2020 11:35

Revisions

  1. nesquena revised this gist Jul 12, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -16,13 +16,13 @@ http {

    # Miso Application Server (http://gomiso.com)
    server {
    listen 192.168.166.97:8080; # Private IP of Varnish Machine
    listen 8080;
    server_name gomiso.com seacliff.gomiso.com localhost;
    root /var/apps/gomiso/current/public;
    include /opt/nginx/conf/includes/server.conf;
    }

    # Miso Secure Server (https://gomiso.com)
    # CodePath (https://codepath.com)
    server {
    listen 443;
    server_name gomiso.com;
  2. nesquena revised this gist Mar 17, 2011. 1 changed file with 0 additions and 11 deletions.
    11 changes: 0 additions & 11 deletions server.conf
    Original file line number Diff line number Diff line change
    @@ -6,17 +6,6 @@ passenger_use_global_queue on;
    rails_spawn_method smart-lv2;
    rack_env production;

    # Add freedom from same origin for APIs
    location /api {
    add_header Access-Control-Allow-Origin *;
    passenger_enabled on;
    }

    location /oauth {
    add_header Access-Control-Allow-Origin *;
    passenger_enabled on;
    }

    # Rewrite /media/... to /m/...
    location /media/ {
    server_name_in_redirect off;
  3. nesquena revised this gist Mar 16, 2011. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions server.conf
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,17 @@ passenger_use_global_queue on;
    rails_spawn_method smart-lv2;
    rack_env production;

    # Add freedom from same origin for APIs
    location /api {
    add_header Access-Control-Allow-Origin *;
    passenger_enabled on;
    }

    location /oauth {
    add_header Access-Control-Allow-Origin *;
    passenger_enabled on;
    }

    # Rewrite /media/... to /m/...
    location /media/ {
    server_name_in_redirect off;
  4. nesquena revised this gist Mar 4, 2011. 1 changed file with 7 additions and 9 deletions.
    16 changes: 7 additions & 9 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,3 @@
    # /opt/nginx/conf/nginx.conf

    worker_processes 4;

    error_log logs/error.log;
    @@ -16,19 +14,19 @@ http {
    # Gzip Compression Configuration
    include /opt/nginx/conf/includes/gzip.conf;

    # Application Server
    # Miso Application Server (http://gomiso.com)
    server {
    listen 80;
    server_name railsapp.com localhost;
    root /var/apps/rails_app/current/public;
    listen 192.168.166.97:8080; # Private IP of Varnish Machine
    server_name gomiso.com seacliff.gomiso.com localhost;
    root /var/apps/gomiso/current/public;
    include /opt/nginx/conf/includes/server.conf;
    }

    # Secure Server
    # Miso Secure Server (https://gomiso.com)
    server {
    listen 443;
    server_name railsapp.com;
    root /var/apps/railsapp/current/public;
    server_name gomiso.com;
    root /var/apps/gomiso/current/public;
    include /opt/nginx/conf/includes/server.conf;
    include /opt/nginx/conf/includes/ssl.conf;
    }
  5. nesquena revised this gist Mar 4, 2011. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions server.conf
    Original file line number Diff line number Diff line change
    @@ -55,6 +55,12 @@ location ~* "/assets/" {
    break;
    }

    # Dragonfly asset caching (must go to passenger)
    location ~* \/uploads\/ {
    expires max;
    passenger_enabled on;
    }

    # error_page 500 502 503 504 /50x.html;
    # location = /50x.html {
    # root html;
  6. nesquena revised this gist Mar 4, 2011. 1 changed file with 13 additions and 1 deletion.
    14 changes: 13 additions & 1 deletion server.conf
    Original file line number Diff line number Diff line change
    @@ -3,9 +3,21 @@
    # Passenger server specific settings
    passenger_enabled on;
    passenger_use_global_queue on;
    rails_spawn_method smart;
    rails_spawn_method smart-lv2;
    rack_env production;

    # Rewrite /media/... to /m/...
    location /media/ {
    server_name_in_redirect off;
    rewrite (/media/)(.*)$ /m/$2 permanent;
    }

    # Rewrite /users/... to /u/...
    location /users/ {
    server_name_in_redirect off;
    rewrite (/users/)(.*)$ /u/$2 permanent;
    }

    # Rewrites to maintenance page for capistrano if exists.
    if (-f $document_root/system/maintenance.html){
    rewrite ^(.*)$ /system/maintenance.html break;
  7. nesquena revised this gist Feb 8, 2011. 1 changed file with 1 addition and 9 deletions.
    10 changes: 1 addition & 9 deletions passenger.conf
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,8 @@
    # Passenger global settings
    passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0.pre3;
    passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.2;
    passenger_ruby /usr/local/bin/ruby;
    passenger_max_pool_size 10;
    passenger_min_instances 2;
    passenger_pool_idle_time 0;
    passenger_max_instances_per_app 0;
    passenger_pre_start http://railsapp.com;


    # Passenger global settings
    # passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15;
    # passenger_ruby /usr/local/bin/ruby;
    # passenger_max_pool_size 25;
    # passenger_pool_idle_time 0;
    # passenger_max_instances_per_app 0;
  8. nesquena revised this gist Sep 28, 2010. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion passenger.conf
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ passenger_max_pool_size 10;
    passenger_min_instances 2;
    passenger_pool_idle_time 0;
    passenger_max_instances_per_app 0;
    passenger_pre_start http://gomiso.com;
    passenger_pre_start http://railsapp.com;


    # Passenger global settings
  9. nesquena revised this gist Sep 28, 2010. 6 changed files with 96 additions and 3 deletions.
    7 changes: 7 additions & 0 deletions base.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    include mime.types;
    default_type application/octet-stream;
    access_log logs/access.log;
    sendfile on;
    keepalive_timeout 65;
    tcp_nodelay on;
    tcp_nopush on;
    6 changes: 6 additions & 0 deletions gzip.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    gzip on;
    gzip_comp_level 2;
    gzip_proxied any;
    gzip_buffers 16 8k;
    gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_disable "MSIE [1-6].(?!.*SV1)";
    5 changes: 2 additions & 3 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # /opt/nginx/conf/nginx.conf

    worker_processes 4;

    error_log logs/error.log;
    @@ -14,9 +16,6 @@ http {
    # Gzip Compression Configuration
    include /opt/nginx/conf/includes/gzip.conf;

    # Redirects and Rewrite Rules
    include /opt/nginx/conf/includes/rewrites.conf;

    # Application Server
    server {
    listen 80;
    16 changes: 16 additions & 0 deletions passenger.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    # Passenger global settings
    passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0.pre3;
    passenger_ruby /usr/local/bin/ruby;
    passenger_max_pool_size 10;
    passenger_min_instances 2;
    passenger_pool_idle_time 0;
    passenger_max_instances_per_app 0;
    passenger_pre_start http://gomiso.com;


    # Passenger global settings
    # passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15;
    # passenger_ruby /usr/local/bin/ruby;
    # passenger_max_pool_size 25;
    # passenger_pool_idle_time 0;
    # passenger_max_instances_per_app 0;
    49 changes: 49 additions & 0 deletions server.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    # /opt/nginx/conf/includes/server.conf

    # Passenger server specific settings
    passenger_enabled on;
    passenger_use_global_queue on;
    rails_spawn_method smart;
    rack_env production;

    # Rewrites to maintenance page for capistrano if exists.
    if (-f $document_root/system/maintenance.html){
    rewrite ^(.*)$ /system/maintenance.html break;
    }

    # If files exist in public root, serve them directly
    if (-f $document_root/cache/$uri/index.html) {
    rewrite (.*) /cache/$1/index.html break;
    }

    # If the file is stored in the cache folder, serve the file
    if (-f $document_root/cache/$uri) {
    rewrite (.*) /cache/$1 break;
    }

    # If the file is stored in the cache and has an html extension, serve the file
    if (-f $document_root/cache/$uri.html) {
    rewrite (.*) /cache/$1.html break;
    }

    # Sets an expires header for any assets with a query string
    location ~* (stylesheets|javascripts|images|juggernaut) {
    if (!-f $request_filename) {
    break;
    }
    if ($query_string ~* "^[0-9]{3,}$") {
    expires max;
    break;
    }
    }

    # Assets (Jammit) gzipping
    location ~* "/assets/" {
    expires max;
    break;
    }

    # error_page 500 502 503 504 /50x.html;
    # location = /50x.html {
    # root html;
    # }
    16 changes: 16 additions & 0 deletions ssl.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    ssl on;
    ssl_certificate /opt/nginx/conf/ssl/railsapp.com.crt;
    ssl_certificate_key /opt/nginx/conf/ssl/railsapp.com.key;
    ssl_session_timeout 5m;
    ssl_protocols SSLv2 SSLv3 TLSv1;
    ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    ssl_prefer_server_ciphers on;

    # needed for HTTPS
    proxy_set_header X_FORWARDED_PROTO https;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_max_temp_file_size 0;
    # needed to forward user's IP address to rails
    proxy_set_header X-Real-IP $remote_addr;
  10. nesquena revised this gist Sep 28, 2010. 1 changed file with 18 additions and 122 deletions.
    140 changes: 18 additions & 122 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -7,134 +7,30 @@ events {
    }

    http {
    # Passenger global settings
    passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15;
    passenger_ruby /usr/local/bin/ruby;
    passenger_max_pool_size 10;
    passenger_pool_idle_time 0;
    passenger_max_instances_per_app 0;

    include mime.types;
    default_type application/octet-stream;
    # Passenger Global Configurations
    include /opt/nginx/conf/includes/passenger.conf;
    # Basic Nginx Configuration
    include /opt/nginx/conf/includes/base.conf;
    # Gzip Compression Configuration
    include /opt/nginx/conf/includes/gzip.conf;

    access_log logs/access.log;

    sendfile on;
    keepalive_timeout 65;
    tcp_nodelay on;
    tcp_nopush on;

    gzip on;
    gzip_comp_level 2;
    gzip_proxied any;
    gzip_buffers 16 8k;
    gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_disable "MSIE [1-6].(?!.*SV1)";

    server {
    listen 80;
    server_name www.gomiso.com;
    rewrite ^/(.*) http://gomiso.com/$1 permanent;
    }
    # Redirects and Rewrite Rules
    include /opt/nginx/conf/includes/rewrites.conf;

    # Application Server
    server {
    listen 80;
    server_name flixup.com www.flixup.com;
    rewrite ^/(.*) http://gomiso.com permanent;
    server_name railsapp.com localhost;
    root /var/apps/rails_app/current/public;
    include /opt/nginx/conf/includes/server.conf;
    }

    # Secure Server
    server {
    listen 80;
    server_name demo.com;
    root /var/apps/demo/current/public;

    # Passenger server specific settings
    passenger_enabled on;
    rails_spawn_method smart;
    rack_env production;

    # Rewrites to maintenance page for capistrano if exists.
    if (-f $document_root/system/maintenance.html){
    rewrite ^(.*)$ /system/maintenance.html break;
    }

    # <<<<< PAGE CACHING
    # If files exist in public root, serve them directly
    if (-f $document_root/cache/$uri/index.html) {
    rewrite (.*) /cache/$1/index.html break;
    }

    # If the file is stored in the cache folder, serve the file
    if (-f $document_root/cache/$uri) {
    rewrite (.*) /cache/$1 break;
    }

    # If the file is stored in the cache and has an html extension, serve the file
    if (-f $document_root/cache/$uri.html) {
    rewrite (.*) /cache/$1.html break;
    }
    # PAGE CACHING >>>>>>>>

    # Sets an expires header for any assets with a query string
    location ~* (stylesheets|javascripts|images) {
    if (!-f $request_filename) {
    break;
    }
    if ($query_string ~* "^[0-9]{10}$") {
    expires max;
    break;
    }
    }

    # error_page 500 502 503 504 /50x.html;
    # location = /50x.html {
    # root html;
    # }
    }

    server {
    listen 443;
    server_name demo.com;
    root /var/apps/demo/current/public;
    passenger_enabled on;
    rack_env production;

    ssl on;
    ssl_certificate ssl/demo.com.crt;
    ssl_certificate_key ssl/demo.com.key;
    ssl_session_timeout 5m;
    ssl_protocols SSLv2 SSLv3 TLSv1;
    ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    ssl_prefer_server_ciphers on;

    # needed for HTTPS
    proxy_set_header X_FORWARDED_PROTO https;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_max_temp_file_size 0;
    # needed to forward user's IP address to rails
    proxy_set_header X-Real-IP $remote_addr;

    # Rewrites to maintenance page for capistrano if exists.
    if (-f $document_root/system/maintenance.html){
    rewrite ^(.*)$ /system/maintenance.html break;
    }

    # Sets an expires header for any assets with a query string
    location ~* (stylesheets|javascripts|images) {
    if (!-f $request_filename) {
    break;
    }
    if ($query_string ~* "^[0-9]{10}$") {
    expires max;
    break;
    }
    }

    # error_page 500 502 503 504 /50x.html;
    # location = /50x.html {
    # root html;
    # }
    listen 443;
    server_name railsapp.com;
    root /var/apps/railsapp/current/public;
    include /opt/nginx/conf/includes/server.conf;
    include /opt/nginx/conf/includes/ssl.conf;
    }
    }
  11. nesquena revised this gist Aug 5, 2010. 1 changed file with 7 additions and 6 deletions.
    13 changes: 7 additions & 6 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -77,12 +77,13 @@ http {

    # Sets an expires header for any assets with a query string
    location ~* (stylesheets|javascripts|images) {
    if (!-f $request_filename) {
    break;
    }
    if ($query_string ~* "^[0-9]{10}$") {
    expires max;
    break;
    if (!-f $request_filename) {
    break;
    }
    if ($query_string ~* "^[0-9]{10}$") {
    expires max;
    break;
    }
    }

    # error_page 500 502 503 504 /50x.html;
  12. nesquena revised this gist Aug 5, 2010. 1 changed file with 7 additions and 14 deletions.
    21 changes: 7 additions & 14 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -84,12 +84,11 @@ http {
    expires max;
    break;
    }
    }

    # error_page 500 502 503 504 /50x.html;
    # location = /50x.html {
    # root html;
    # }
    # error_page 500 502 503 504 /50x.html;
    # location = /50x.html {
    # root html;
    # }
    }

    server {
    @@ -116,17 +115,12 @@ http {
    # needed to forward user's IP address to rails
    proxy_set_header X-Real-IP $remote_addr;

    # Rewrites to maintenance page for capistrano if exists.
    # Rewrites to maintenance page for capistrano if exists.
    if (-f $document_root/system/maintenance.html){
    rewrite ^(.*)$ /system/maintenance.html break;
    }

    # Rewrite www.demo.com --> demo.com
    if ($host != 'demo.com' ) {
    rewrite ^/(.*)$ http://demo.com/$1 permanent;
    }

    # Sets an expires header for any assets with a query string

    # Sets an expires header for any assets with a query string
    location ~* (stylesheets|javascripts|images) {
    if (!-f $request_filename) {
    break;
    @@ -141,6 +135,5 @@ http {
    # location = /50x.html {
    # root html;
    # }

    }
    }
  13. nesquena revised this gist Aug 5, 2010. 1 changed file with 43 additions and 19 deletions.
    62 changes: 43 additions & 19 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -31,41 +31,65 @@ http {
    gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_disable "MSIE [1-6].(?!.*SV1)";

    server {
    listen 80;
    server_name www.gomiso.com;
    rewrite ^/(.*) http://gomiso.com/$1 permanent;
    }

    server {
    listen 80;
    server_name flixup.com www.flixup.com;
    rewrite ^/(.*) http://gomiso.com permanent;
    }

    server {
    listen 80;
    server_name demo.com;
    root /var/apps/demo/current/public;

    # Passenger server specific settings
    # Passenger server specific settings
    passenger_enabled on;
    rails_spawn_method smart;
    rack_env production;

    # Rewrites to maintenance page for capistrano if exists.
    # Rewrites to maintenance page for capistrano if exists.
    if (-f $document_root/system/maintenance.html){
    rewrite ^(.*)$ /system/maintenance.html break;
    }
    }

    # Rewrite www.demo.com --> demo.com
    if ($host != 'demo.com' ) {
    rewrite ^/(.*)$ http://demo.com/$1 permanent;
    # <<<<< PAGE CACHING
    # If files exist in public root, serve them directly
    if (-f $document_root/cache/$uri/index.html) {
    rewrite (.*) /cache/$1/index.html break;
    }

    # Sets an expires header for any assets with a query string

    # If the file is stored in the cache folder, serve the file
    if (-f $document_root/cache/$uri) {
    rewrite (.*) /cache/$1 break;
    }

    # If the file is stored in the cache and has an html extension, serve the file
    if (-f $document_root/cache/$uri.html) {
    rewrite (.*) /cache/$1.html break;
    }
    # PAGE CACHING >>>>>>>>

    # Sets an expires header for any assets with a query string
    location ~* (stylesheets|javascripts|images) {
    if (!-f $request_filename) {
    break;
    }
    if ($query_string ~* "^[0-9]{10}$") {
    expires max;
    break;
    }
    if (!-f $request_filename) {
    break;
    }
    if ($query_string ~* "^[0-9]{10}$") {
    expires max;
    break;
    }
    }

    # error_page 500 502 503 504 /50x.html;
    # location = /50x.html {
    # root html;
    # }
    # error_page 500 502 503 504 /50x.html;
    # location = /50x.html {
    # root html;
    # }
    }

    server {
  14. nesquena revised this gist Jul 27, 2010. 1 changed file with 45 additions and 36 deletions.
    81 changes: 45 additions & 36 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -32,47 +32,46 @@ http {
    gzip_disable "MSIE [1-6].(?!.*SV1)";

    server {
    listen 80;
    server_name localhost;
    root /var/apps/gomiso/current/public;

    # Passenger server specific settings
    passenger_enabled on;
    rails_spawn_method smart;
    rack_env production;

    # Rewrites to maintenance page for capistrano if exists.
    if (-f $document_root/system/maintenance.html){
    rewrite ^(.*)$ /system/maintenance.html break;
    }

    # This is only during testing, to be removed
    if ($host != 'mission.gomiso.com' ) {
    rewrite ^(.*)$ /system/maintenance.html break;
    }
    listen 80;
    server_name demo.com;
    root /var/apps/demo/current/public;

    # Passenger server specific settings
    passenger_enabled on;
    rails_spawn_method smart;
    rack_env production;

    # Rewrites to maintenance page for capistrano if exists.
    if (-f $document_root/system/maintenance.html){
    rewrite ^(.*)$ /system/maintenance.html break;
    }

    # Rewrite www.demo.com --> demo.com
    if ($host != 'demo.com' ) {
    rewrite ^/(.*)$ http://demo.com/$1 permanent;
    }

    # Sets an expires header for any assets with a query string
    location ~* (stylesheets|javascripts|images) {
    if (!-f $request_filename) {
    break;
    }
    if ($query_string ~* "^[0-9]{10}$") {
    expires max;
    break;
    }
    # Sets an expires header for any assets with a query string
    location ~* (stylesheets|javascripts|images) {
    if (!-f $request_filename) {
    break;
    }
    if ($query_string ~* "^[0-9]{10}$") {
    expires max;
    break;
    }
    }

    # error_page 500 502 503 504 /50x.html;
    # location = /50x.html {
    # root html;
    # }

    # error_page 500 502 503 504 /50x.html;
    # location = /50x.html {
    # root html;
    # }
    }

    server {
    listen 443;
    server_name localhost;
    root /var/apps/path/current/public;
    server_name demo.com;
    root /var/apps/demo/current/public;
    passenger_enabled on;
    rack_env production;

    @@ -92,8 +91,18 @@ http {
    proxy_max_temp_file_size 0;
    # needed to forward user's IP address to rails
    proxy_set_header X-Real-IP $remote_addr;

    # Sets an expires header for any assets with a query string

    # Rewrites to maintenance page for capistrano if exists.
    if (-f $document_root/system/maintenance.html){
    rewrite ^(.*)$ /system/maintenance.html break;
    }

    # Rewrite www.demo.com --> demo.com
    if ($host != 'demo.com' ) {
    rewrite ^/(.*)$ http://demo.com/$1 permanent;
    }

    # Sets an expires header for any assets with a query string
    location ~* (stylesheets|javascripts|images) {
    if (!-f $request_filename) {
    break;
  15. nesquena revised this gist Jul 27, 2010. 2 changed files with 28 additions and 96 deletions.
    38 changes: 28 additions & 10 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -6,8 +6,8 @@ events {
    worker_connections 1024;
    }


    http {
    # Passenger global settings
    passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15;
    passenger_ruby /usr/local/bin/ruby;
    passenger_max_pool_size 10;
    @@ -35,11 +35,23 @@ http {
    listen 80;
    server_name localhost;
    root /var/apps/gomiso/current/public;

    # Passenger server specific settings
    passenger_enabled on;
    rails_spawn_method smart;
    rack_env production;


    # Rewrites to maintenance page for capistrano if exists.
    if (-f $document_root/system/maintenance.html){
    rewrite ^(.*)$ /system/maintenance.html break;
    }

    # This is only during testing, to be removed
    if ($host != 'mission.gomiso.com' ) {
    rewrite ^(.*)$ /system/maintenance.html break;
    }

    # Sets an expires header for any assets with a query string
    location ~* (stylesheets|javascripts|images) {
    if (!-f $request_filename) {
    break;
    @@ -60,22 +72,28 @@ http {
    server {
    listen 443;
    server_name localhost;
    root /var/apps/gomiso/current/public;
    root /var/apps/path/current/public;
    passenger_enabled on;
    rack_env production;

    # ssl on;
    # ssl_certificate /opt/nginx/ssl/certs/server.crt;
    # ssl_certificate_key /opt/nginx/ssl/private/server.key;
    ssl on;
    ssl_certificate ssl/demo.com.crt;
    ssl_certificate_key ssl/demo.com.key;
    ssl_session_timeout 5m;
    ssl_protocols SSLv2 SSLv3 TLSv1;
    ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    ssl_prefer_server_ciphers on;

    # needed for HTTPS
    proxy_set_header X_FORWARDED_PROTO https;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_max_temp_file_size 0;



    # needed to forward user's IP address to rails
    proxy_set_header X-Real-IP $remote_addr;

    # Sets an expires header for any assets with a query string
    location ~* (stylesheets|javascripts|images) {
    if (!-f $request_filename) {
    break;
    @@ -92,4 +110,4 @@ http {
    # }

    }
    }
    }
    86 changes: 0 additions & 86 deletions nginx.conf.default
    Original file line number Diff line number Diff line change
    @@ -1,86 +0,0 @@
    #user nobody;
    worker_processes 4;

    #error_log logs/error.log;
    #error_log logs/error.log notice;
    #error_log logs/error.log info;

    #pid logs/nginx.pid;


    events {
    worker_connections 1024;
    }


    http {
    passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15;
    passenger_ruby /usr/local/bin/ruby;
    passenger_max_pool_size 10;

    include mime.types;
    default_type application/octet-stream;

    #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    # '$status $body_bytes_sent "$http_referer" '
    # '"$http_user_agent" "$http_x_forwarded_for"';

    access_log logs/access.log;

    sendfile on;
    #tcp_nopush on;

    #keepalive_timeout 0;
    keepalive_timeout 65;
    tcp_nodelay on;

    gzip on;
    gzip_comp_level 2;
    gzip_proxied any;

    server {
    listen 80;
    server_name localhost;
    root /var/apps/gomiso/current/public;
    passenger_enabled on;
    rails_spawn_method smart;
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    # listen 8000;
    # listen somename:8080;
    # server_name somename alias another.alias;

    # location / {
    # root html;
    # index index.html index.htm;
    # }
    #}


    # HTTPS server
    #
    #server {
    # listen 443;
    # server_name localhost;

    # ssl on;
    # ssl_certificate cert.pem;
    # ssl_certificate_key cert.key;

    # ssl_session_timeout 5m;

    # ssl_protocols SSLv2 SSLv3 TLSv1;
    # ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    # ssl_prefer_server_ciphers on;

    # location / {
    # root html;
    # index index.html index.htm;
    # }
    #}

    }
  16. nesquena revised this gist Jul 23, 2010. 1 changed file with 13 additions and 4 deletions.
    17 changes: 13 additions & 4 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -39,8 +39,12 @@ http {
    rails_spawn_method smart;
    rack_env production;

    location ~* \.(ico|css|js|gif|jp?g|png) {
    if ($args ~* [0-9]+$) {

    location ~* (stylesheets|javascripts|images) {
    if (!-f $request_filename) {
    break;
    }
    if ($query_string ~* "^[0-9]{10}$") {
    expires max;
    break;
    }
    @@ -70,8 +74,13 @@ http {
    proxy_redirect off;
    proxy_max_temp_file_size 0;

    location ~* \.(ico|css|js|gif|jp?g|png) {
    if ($args ~* [0-9]+$) {


    location ~* (stylesheets|javascripts|images) {
    if (!-f $request_filename) {
    break;
    }
    if ($query_string ~* "^[0-9]{10}$") {
    expires max;
    break;
    }
  17. nesquena revised this gist Jul 23, 2010. 1 changed file with 9 additions and 5 deletions.
    14 changes: 9 additions & 5 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -38,10 +38,12 @@ http {
    passenger_enabled on;
    rails_spawn_method smart;
    rack_env production;

    location ~* \.(ico|css|js|gif|jpe?g|png)\?[0-9]+$ {

    location ~* \.(ico|css|js|gif|jp?g|png) {
    if ($args ~* [0-9]+$) {
    expires max;
    break;
    }
    }

    # error_page 500 502 503 504 /50x.html;
    @@ -68,9 +70,11 @@ http {
    proxy_redirect off;
    proxy_max_temp_file_size 0;

    location ~* \.(ico|css|js|gif|jpe?g|png)\?[0-9]+$ {
    expires max;
    break;
    location ~* \.(ico|css|js|gif|jp?g|png) {
    if ($args ~* [0-9]+$) {
    expires max;
    break;
    }
    }

    # error_page 500 502 503 504 /50x.html;
  18. nesquena revised this gist Jul 23, 2010. 1 changed file with 5 additions and 12 deletions.
    17 changes: 5 additions & 12 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,3 @@
    # /opt/nginx/conf/nginx.conf

    # user nobody;
    worker_processes 4;

    error_log logs/error.log;
    @@ -42,11 +39,9 @@ http {
    rails_spawn_method smart;
    rack_env production;

    location ~* \.(js|css|jpg|jpeg|gif|png)$ {
    if (-f $request_filename) {
    expires max;
    location ~* \.(ico|css|js|gif|jpe?g|png)\?[0-9]+$ {
    expires max;
    break;
    }
    }

    # error_page 500 502 503 504 /50x.html;
    @@ -73,11 +68,9 @@ http {
    proxy_redirect off;
    proxy_max_temp_file_size 0;

    location ~* \.(js|css|jpg|jpeg|gif|png)$ {
    if (-f $request_filename) {
    expires max;
    break;
    }
    location ~* \.(ico|css|js|gif|jpe?g|png)\?[0-9]+$ {
    expires max;
    break;
    }

    # error_page 500 502 503 504 /50x.html;
  19. nesquena revised this gist Jul 21, 2010. 1 changed file with 32 additions and 34 deletions.
    66 changes: 32 additions & 34 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -1,91 +1,89 @@
    # /opt/nginx/conf/nginx.conf

    # user nobody;
    worker_processes 4;
    # user nobody;
    worker_processes 4;

    error_log logs/error.log;
    error_log logs/error.log;

    events {
    worker_connections 1024;
    worker_connections 1024;
    }


    http {
    passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15;
    passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15;
    passenger_ruby /usr/local/bin/ruby;
    passenger_max_pool_size 10;
    passenger_max_pool_size 10;
    passenger_pool_idle_time 0;
    passenger_max_instances_per_app 0;
    passenger_max_instances_per_app 0;

    include mime.types;
    default_type application/octet-stream;
    include mime.types;
    default_type application/octet-stream;

    access_log logs/access.log;
    access_log logs/access.log;

    sendfile on;
    keepalive_timeout 65;
    sendfile on;
    keepalive_timeout 65;
    tcp_nodelay on;
    tcp_nopush on;
    tcp_nopush on;

    gzip on;
    gzip_comp_level 2;
    gzip_proxied any;
    gzip_buffers 16 8k;
    gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_proxied any;
    gzip_buffers 16 8k;
    gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_disable "MSIE [1-6].(?!.*SV1)";

    server {
    listen 80;
    server_name localhost;
    listen 80;
    server_name localhost;
    root /var/apps/gomiso/current/public;
    passenger_enabled on;
    rails_spawn_method smart;
    rack_env production;

    location ~* \.(js|css|jpg|jpeg|gif|png)$ {
    if (-f $request_filename) {
    expires max;
    expires max;
    break;
    }
    }

    # error_page 500 502 503 504 /50x.html;
    # error_page 500 502 503 504 /50x.html;
    # location = /50x.html {
    # root html;
    # root html;
    # }

    }

    server {
    listen 443;
    server_name **secret_and_stuff**;
    listen 443;
    server_name localhost;
    root /var/apps/gomiso/current/public;
    passenger_enabled on;
    rack_env production;

    ssl on;
    ssl_certificate /opt/nginx/ssl/certs/server.crt;
    ssl_certificate_key /opt/nginx/ssl/private/server.key;
    # ssl on;
    # ssl_certificate /opt/nginx/ssl/certs/server.crt;
    # ssl_certificate_key /opt/nginx/ssl/private/server.key;

    # needed for HTTPS
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect false;
    proxy_redirect off;
    proxy_max_temp_file_size 0;

    location ~* \.(js|css|jpg|jpeg|gif|png)$ {
    if (-f $request_filename) {
    expires max;
    expires max;
    break;
    }
    }

    rack_env production;

    # error_page 500 502 503 504 /50x.html;
    # error_page 500 502 503 504 /50x.html;
    # location = /50x.html {
    # root html;
    # root html;
    # }

    }

    }
  20. nesquena revised this gist Jul 21, 2010. 1 changed file with 47 additions and 0 deletions.
    47 changes: 47 additions & 0 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -40,5 +40,52 @@ http {
    root /var/apps/gomiso/current/public;
    passenger_enabled on;
    rails_spawn_method smart;
    rack_env production;

    location ~* \.(js|css|jpg|jpeg|gif|png)$ {
    if (-f $request_filename) {
    expires max;
    break;
    }
    }

    # error_page 500 502 503 504 /50x.html;
    # location = /50x.html {
    # root html;
    # }

    }

    server {
    listen 443;
    server_name **secret_and_stuff**;
    root /var/apps/gomiso/current/public;
    passenger_enabled on;

    ssl on;
    ssl_certificate /opt/nginx/ssl/certs/server.crt;
    ssl_certificate_key /opt/nginx/ssl/private/server.key;

    # needed for HTTPS
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect false;
    proxy_max_temp_file_size 0;

    location ~* \.(js|css|jpg|jpeg|gif|png)$ {
    if (-f $request_filename) {
    expires max;
    break;
    }
    }

    rack_env production;

    # error_page 500 502 503 504 /50x.html;
    # location = /50x.html {
    # root html;
    # }

    }

    }
  21. nesquena revised this gist Jul 21, 2010. 2 changed files with 1 addition and 2 deletions.
    2 changes: 1 addition & 1 deletion nginx.conf
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@ http {
    gzip_comp_level 2;
    gzip_proxied any;
    gzip_buffers 16 8k;
    gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_disable "MSIE [1-6].(?!.*SV1)";

    server {
    1 change: 0 additions & 1 deletion nginx.conf.default
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    #user nobody;
    worker_processes 4;

  22. nesquena revised this gist Jul 21, 2010. 1 changed file with 87 additions and 0 deletions.
    87 changes: 87 additions & 0 deletions nginx.conf.default
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,87 @@

    #user nobody;
    worker_processes 4;

    #error_log logs/error.log;
    #error_log logs/error.log notice;
    #error_log logs/error.log info;

    #pid logs/nginx.pid;


    events {
    worker_connections 1024;
    }


    http {
    passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15;
    passenger_ruby /usr/local/bin/ruby;
    passenger_max_pool_size 10;

    include mime.types;
    default_type application/octet-stream;

    #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    # '$status $body_bytes_sent "$http_referer" '
    # '"$http_user_agent" "$http_x_forwarded_for"';

    access_log logs/access.log;

    sendfile on;
    #tcp_nopush on;

    #keepalive_timeout 0;
    keepalive_timeout 65;
    tcp_nodelay on;

    gzip on;
    gzip_comp_level 2;
    gzip_proxied any;

    server {
    listen 80;
    server_name localhost;
    root /var/apps/gomiso/current/public;
    passenger_enabled on;
    rails_spawn_method smart;
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    # listen 8000;
    # listen somename:8080;
    # server_name somename alias another.alias;

    # location / {
    # root html;
    # index index.html index.htm;
    # }
    #}


    # HTTPS server
    #
    #server {
    # listen 443;
    # server_name localhost;

    # ssl on;
    # ssl_certificate cert.pem;
    # ssl_certificate_key cert.key;

    # ssl_session_timeout 5m;

    # ssl_protocols SSLv2 SSLv3 TLSv1;
    # ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    # ssl_prefer_server_ciphers on;

    # location / {
    # root html;
    # index index.html index.htm;
    # }
    #}

    }
  23. nesquena revised this gist Jul 21, 2010. 1 changed file with 9 additions and 53 deletions.
    62 changes: 9 additions & 53 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -3,42 +3,36 @@
    # user nobody;
    worker_processes 4;

    #error_log logs/error.log;
    #error_log logs/error.log notice;
    #error_log logs/error.log info;

    #pid logs/nginx.pid;

    error_log logs/error.log;

    events {
    worker_connections 1024;
    worker_connections 1024;
    }


    http {
    passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15;
    passenger_ruby /usr/local/bin/ruby;
    passenger_max_pool_size 10;
    passenger_max_pool_size 10;
    passenger_pool_idle_time 0;
    passenger_max_instances_per_app 0;

    include mime.types;
    default_type application/octet-stream;

    #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    # '$status $body_bytes_sent "$http_referer" '
    # '"$http_user_agent" "$http_x_forwarded_for"';

    access_log logs/access.log;

    sendfile on;
    #tcp_nopush on;

    #keepalive_timeout 0;
    keepalive_timeout 65;
    tcp_nodelay on;
    tcp_nopush on;

    gzip on;
    gzip_comp_level 2;
    gzip_proxied any;
    gzip_buffers 16 8k;
    gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_disable "MSIE [1-6].(?!.*SV1)";

    server {
    listen 80;
    @@ -47,42 +41,4 @@ http {
    passenger_enabled on;
    rails_spawn_method smart;
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    # listen 8000;
    # listen somename:8080;
    # server_name somename alias another.alias;

    # location / {
    # root html;
    # index index.html index.htm;
    # }
    #}


    # HTTPS server
    #
    #server {
    # listen 443;
    # server_name localhost;

    # ssl on;
    # ssl_certificate cert.pem;
    # ssl_certificate_key cert.key;

    # ssl_session_timeout 5m;

    # ssl_protocols SSLv2 SSLv3 TLSv1;
    # ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    # ssl_prefer_server_ciphers on;

    # location / {
    # root html;
    # index index.html index.htm;
    # }
    #}

    }
  24. nesquena created this gist Jul 21, 2010.
    88 changes: 88 additions & 0 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,88 @@
    # /opt/nginx/conf/nginx.conf

    # user nobody;
    worker_processes 4;

    #error_log logs/error.log;
    #error_log logs/error.log notice;
    #error_log logs/error.log info;

    #pid logs/nginx.pid;


    events {
    worker_connections 1024;
    }


    http {
    passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15;
    passenger_ruby /usr/local/bin/ruby;
    passenger_max_pool_size 10;

    include mime.types;
    default_type application/octet-stream;

    #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    # '$status $body_bytes_sent "$http_referer" '
    # '"$http_user_agent" "$http_x_forwarded_for"';

    access_log logs/access.log;

    sendfile on;
    #tcp_nopush on;

    #keepalive_timeout 0;
    keepalive_timeout 65;
    tcp_nodelay on;

    gzip on;
    gzip_comp_level 2;
    gzip_proxied any;

    server {
    listen 80;
    server_name localhost;
    root /var/apps/gomiso/current/public;
    passenger_enabled on;
    rails_spawn_method smart;
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    # listen 8000;
    # listen somename:8080;
    # server_name somename alias another.alias;

    # location / {
    # root html;
    # index index.html index.htm;
    # }
    #}


    # HTTPS server
    #
    #server {
    # listen 443;
    # server_name localhost;

    # ssl on;
    # ssl_certificate cert.pem;
    # ssl_certificate_key cert.key;

    # ssl_session_timeout 5m;

    # ssl_protocols SSLv2 SSLv3 TLSv1;
    # ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    # ssl_prefer_server_ciphers on;

    # location / {
    # root html;
    # index index.html index.htm;
    # }
    #}

    }