config file for only static files.

Amer Shah amerrahman at gmail.com
Sun Apr 6 06:01:39 MSD 2008


Hey Guys.

I've been trying to figure this out from the site but I just can't :(

What I want is the following
- When a user puts it just my domain name, I want the server to give him the
index.htm file .. i.e. if the user enters in example.com I want him to get
www.example.com/index.htm


I tried the following but it I get a 403 forbidden:

     server {
        listen       80;
        server_name  localhost;
        root /usr/local/www/data;

        location / {
          index index.htm;
        }
  }

Am I missing something ?


Here is my full config :

worker_processes  5;
timer_resolution 100ms;


events {
    worker_connections  1500;
}


http {
    include       mime.types;

    sendfile        on;
    tcp_nopush     on;

    keepalive_timeout  65;

    gzip_static on;

    gzip_types  text/plain text/html text/css
    gzip_http_version   1.1;
    gzip_proxied        any;
    gzip_disable        "MSIE [1-6]\.";
    gzip_vary           on;

    open_file_cache          max=10000  inactive=20s;
    open_file_cache_valid    30s;
    open_file_cache_min_uses 2;
    open_file_cache_errors   on;

    server {
        listen       80;
        server_name  localhost;
        root /usr/local/www/data;

        location / {
          index index.htm;
        }
  }
}







On Sat, Apr 5, 2008 at 6:41 PM, Amer Shah <amerrahman at gmail.com> wrote:

> Okay I've crossed 4000 (consistently between 4100 and 4200) now but I had
> a couple of questions.
>
> First of all, I'm using nginx-0.6.29.tar.gz<http://sysoev.ru/nginx/nginx-0.6.29.tar.gz>from
> http://sysoev.ru/nginx/download.html .. I build it from source. I don't
> understand the Russian on that site but it seems to me
> that this is a developement version? Is this stable to use in production?
>
> Secondly I noticed something strange with gzip_static on. If I have this
> in my conf and I have a file indexd12.htm as well as indexd12.htm.gz in the
> root then even though I have
> indexd12.htm.gz it still picks up indexd12.htm .. However when I delete
> indexd12.htm , then the server rightly sends back indexdh1.htm.gz ..
> According to http://wiki.codemongers.com/NginxHttpGzipStaticModule,
> the server should be sending back indexd12.htm.gz even if there is an
> indexd12.htm in the directory. Any thoughts?
>
> rkmr.em, this is my final config file (I also bumped up max allowed file
> descriptors in freebsd kernel):
>
> worker_processes  5;
> timer_resolution 100ms;
>
>
> events {
>     worker_connections  1500;
> }
>
>
> http {
>     include       mime.types;
>     default_type  application/octet-stream;
>
>     sendfile        on;
>     tcp_nopush     on;
>
>     keepalive_timeout  65;
>
>     gzip_static on;
>
>     gzip_http_version   1.1;
>     gzip_proxied        expired no-cache no-store private auth;
>     gzip_disable        "MSIE [1-6]\.";
>     gzip_vary           on;
>
>    open_file_cache          max=10000  inactive=20s;
>    open_file_cache_valid    30s;
>    open_file_cache_min_uses 2;
>    open_file_cache_errors   on;
>
>      server {
>         listen       8080;
>         server_name  localhost;
>
>         location / {
>             root   /usr/local/www/data;
>             index  indexd12.htm;
>
>         }
>      }
>
> }
>
>
>
>
>
> On Sat, Apr 5, 2008 at 5:47 PM, rkmr.em at gmail.com <rkmr.em at gmail.com>
> wrote:
>
> > Aamer,
> > Can you post final config that gave you 3900 reqs/second?
> > thanks
> >
> > On Sat, Apr 5, 2008 at 1:21 PM, Amer Shah <amerrahman at gmail.com> wrote:
> > > Thanks for the feedback guys.
> > >
> > > Apart from turning gzip_static, I did what you guys suggested and I'm
> > up to
> > > consistently 3900 Requests/Second in benchmarking.
> > > Possibly with gzip_static, I can break the 4000 mark. Thanks guys !
> > >
> > >
> > >
> > > On Sat, Apr 5, 2008 at 4:51 AM, Igor Sysoev <is at rambler-co.ru> wrote:
> > > >
> > > >
> > > >
> > > > On Sat, Apr 05, 2008 at 03:55:47AM +0000, Amer wrote:
> > > >
> > > > > I wanted to run a particular configuration by you guys to get your
> > > thoughts. I'm
> > > > > moving from lighttpd to nginx.
> > > > >
> > > > > First a little bit of background. The site is a single server
> > running
> > > FreeBsd.
> > > > > It's a Dual Processor Quad Core Xeon 5310 1.60GHz (Clovertown)
> > with a 2
> > > x 8MB
> > > > > cache and 4 GB RAM. The site serves only static content. There is
> > > absolutely
> > > > > zero dynamic content. No databases involved. Each static file is
> > about
> > > 50 kb.
> > > > >
> > > > > I get about 3000-3500 requests/second with lightpd and with my
> > initial
> > > setup of
> > > > > nginx I get about the same. While I'm happy with this I used a
> > very
> > > simple
> > > > > config file and just wanted to see if the experienced folks over
> > here
> > > could
> > > > > point out some things that might be able to boost that up even
> > further.
> > > It's
> > > > > very simple and short (just about 20 lines) and I hope some of you
> > could
> > > give me
> > > > > some advise to get more performance (if possible).
> > > > >
> > > > > ----------------------------------------------
> > > > >
> > > > > worker_processes  4;
> > > > >
> > > > > events {
> > > > >     worker_connections  1024;
> > > > > }
> > > > >
> > > > > http {
> > > > >     include       mime.types;
> > > > >     default_type  application/octet-stream;
> > > > >
> > > > >     sendfile        on;
> > > > >     tcp_nopush     on;
> > > > >
> > > > >     keepalive_timeout  65;
> > > > >
> > > > >     gzip  on;
> > > > >     gzip_types      text/plain text/html text/css
> > > application/x-javascript
> > > > >                     text/xml application/xml application/xml+rss
> > > ext/javascript;
> > > > >
> > > > >     server {
> > > > >         listen       80;
> > > > >         server_name  localhost;
> > > > >
> > > > >         location / {
> > > > >             root   /usr/local/www/data;
> > > > >             index  indexd12.html;
> > > > >         }
> > > > >
> > > > >         error_page  404              /404.html;
> > > > >
> > > > >     }
> > > > > }
> > > >
> > > > As it was suggested, try to use gzip_static.
> > > >
> > > > Also, remove unused MIME types from gzip_types.
> > > > There is no application/xml, application/xml+rss, and ext/javascript
> > > > in default miem.types. The gzip modules tests Content-Type
> > sequentially,
> > > > so the shorter list is the better.
> > > >
> > > > You may need to increase worker_connections, 1024 mean that you are
> > > > able to handle 4*1024 connections only. You also need to increase
> > > > number of files, sockets, etc in kernel.
> > > >
> > > > If you do not need access_log, you may set it off.
> > > > Or, you may use buffered log:
> > > >
> > > > http {
> > > >
> > > >    access_log   /path/to/log  buffer=32k;
> > > >
> > > > Also you may marginally decrease number of syscalls using:
> > > >
> > > > timer_resolution  100ms;
> > > >
> > > > And finally use open file descriptor cache to decrease number of
> > > > open()/stat()/close() syscalls:
> > > >
> > > > http {
> > > >
> > > >    open_file_cache          max=10000  inactive=20s;
> > > >    open_file_cache_valid    30s;
> > > >    open_file_cache_min_uses 2;
> > > >    open_file_cache_errors   on;
> > > >
> > > >
> > > > However, I do not think that all these settings will result in more
> > > > requests/seconds in your environment.
> > > >
> > > >
> > > > --
> > > > Igor Sysoev
> > > > http://sysoev.ru/en/
> > > >
> > > >
> > >
> > >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20080405/6a334690/attachment.html>


More information about the nginx mailing list