NGINX - performance HTTP server Support Forums

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Unofficial (YET) support forums for NGINX, a performance HTTP server.

Pages: [1]   Go Down

Author Topic: Nginx and Mongrel  (Read 609 times)

0 Members and 1 Guest are viewing this topic.

katmai

  • Administrator
  • Jr. Member
  • *****
  • Karma: 0
  • Offline Offline
  • Posts: 57
    • View Profile
Nginx and Mongrel
« on: December 03, 2007, 04:00:29 PM »
quote]curl -O http://sysoev.ru/nginx/nginx-0.3.60.tar.gz
tar -xzvf nginx-0.3.60.tar.gz
cd nginx-0.3.60
./configure --sbin-path=/usr/local/sbin --with-http_ssl_module
make
sudo make install
sudo chmod +x /usr/local/sbin/nginx
That will put the executable at /usr/local/sbin/nginx . ANd it will put the log files and config files in /usr/local/nginx.

And here is my config file so far. Of course replace the paths with your own values:

Quote
user  ez ez;
worker_processes  2;

error_log  logs/error.log notice;
pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       conf/mime.types;
    default_type  application/octet-stream;

    # no sendfile on OSX uncomment
    #this if your on linux or bsd
    #sendfile        on;
    tcp_nopush     on;

    keepalive_timeout  65;
    tcp_nodelay        on;

    upstream mongrel {
        server 127.0.0.1:5001;
        server 127.0.0.1:5002;
        server 127.0.0.1:5003;
    }

    gzip on;
    gzip_min_length  1100;
    gzip_buffers     4 8k;
    gzip_types       text/plain;

    server {
        listen       80;
        #server_name  localhost;
        root /Users/ez/nginx/public;

        access_log  off;
        rewrite_log on;

        location ~ ^/$ {
          if (-f /index.html){
            rewrite (.*) /index.html last;
          }
           proxy_pass  http://mongrel;
        }

        location / {
          if (!-f $request_filename.html) {
            proxy_pass  http://mongrel;
          }
          rewrite (.*) $1.html last;
        }

        location ~ .html {
           root /Users/ez/nginx/public;
        }

           location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov)$ {
          root /Users/ez/nginx/public;
        }

        location / {
            proxy_pass  http://mongrel;
            proxy_redirect     off;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }

    }
}


I will continue to refine this config file and post my experiences here as I figure things out more. So far though. nginx is poised to be my new favorite light webserver and proxy front for rails apps.

Courtesy of brainspl[/url
Quote
curl -O http://sysoev.ru/nginx/nginx-0.3.60.tar.gz
tar -xzvf nginx-0.3.60.tar.gz
cd nginx-0.3.60
./configure --sbin-path=/usr/local/sbin --with-http_ssl_module
make
sudo make install
sudo chmod +x /usr/local/sbin/nginx[/quote]

That will put the executable at /usr/local/sbin/nginx . ANd it will put the log files and config files in /usr/local/nginx.

And here is my config file so far. Of course replace the paths with your own values:

Quote
user  ez ez;
worker_processes  2;

error_log  logs/error.log notice;
pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       conf/mime.types;
    default_type  application/octet-stream;

    # no sendfile on OSX uncomment
    #this if your on linux or bsd
    #sendfile        on;
    tcp_nopush     on;

    keepalive_timeout  65;
    tcp_nodelay        on;

    upstream mongrel {
        server 127.0.0.1:5001;
        server 127.0.0.1:5002;
        server 127.0.0.1:5003;
    }

    gzip on;
    gzip_min_length  1100;
    gzip_buffers     4 8k;
    gzip_types       text/plain;

    server {
        listen       80;
        #server_name  localhost;
        root /Users/ez/nginx/public;

        access_log  off;
        rewrite_log on;

        location ~ ^/$ {
          if (-f /index.html){
            rewrite (.*) /index.html last;
          }
           proxy_pass  [url]http://mongrel;[/url]
        }

        location / {
          if (!-f $request_filename.html) {
            proxy_pass  [url]http://mongrel;[/url]
          }
          rewrite (.*) $1.html last;
        }

        location ~ .html {
           root /Users/ez/nginx/public;
        }

           location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov)$ {
          root /Users/ez/nginx/public;
        }

        location / {
            proxy_pass  [url]http://mongrel;[/url]
            proxy_redirect     off;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }

    }
}


I will continue to refine this config file and post my experiences here as I figure things out more. So far though. nginx is poised to be my new favorite light webserver and proxy front for rails apps.

Courtesy of brainspl
Logged

zlzqq

  • Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 16
  • Just started
    • View Profile
Re: Nginx and Mongrel
« Reply #1 on: August 05, 2010, 07:24:32 AM »


an online book wow power leveling marketing services provider, specializing in providing low-cost, high-quality marketing services wow power leveling for fiction, nonfiction, and poetry books. Through its unique, inexpensive book marketing wow power leveling services, BookWhirl.com helps authors promote their published works more wow power leveling effectively and connect to readers in a more effective, more efficient system. "We will continue to press aion power level on for excellence in what we do as an online book marketing services provider. We look aion powerleveling forward in focusing on our mission and vision objectives. And we are excitied to make buy wow gold all of our big plans into reality in the coming years," says Jake Olvido, BookWhirl.com's Marketing aion kinah Officer. College students are known to love customized items which represent their aion power level current stage of life. Often a personalized two pocket folder looks wow gold uk better than a plain one.
Logged
Pages: [1]   Go Up
« previous next »
 

Page created in 0.085 seconds with 20 queries.