nginx virtualhosts

Volkan Flörchinger volkan.f at gmail.com
Wed Jan 9 19:59:05 MSK 2008


unsubscribe
On Jan 9, 2008, at 2:59 PM, Stefanita rares Dumitrescu wrote:

> user  nobody;
> worker_processes  10;
> 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 {
>    include       mime.types;
>    default_type  application/octet-stream;
>    server_names_hash_bucket_size  128;
>    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  main;
>    sendfile        on;
>    #tcp_nopush     on;
>    keepalive_timeout  20;
>    #gzip  on;
>
>    server {
>        listen       11.11.11.11:80;
>        server_name  host1.com;
>        #charset koi8-r;
>        access_log  logs/host1.com.access.log main;
>
>        location / {
>            root   /home/fs01/www;
>            index  index.html index.htm index.php;
>        }
>
>        # serve static files directly
>        location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|flv|zip|mp3)$ {
>            root              /home/fs01/storage;
>            access_log        off;
>            expires           30d;
>        }
>
>
>        location / {
>            proxy_pass        http://localhost:8000/;
>            proxy_redirect    off;
>            proxy_set_header  X-Forwarded-For
> $proxy_add_x_forwarded_for;
>            proxy_set_header  X-Real-IP  $remote_addr;
>            proxy_set_header  Host $http_host;
>        }
>
>        # redirect server error pages to the static page /50x.html
>        #
>        error_page   500 502 503 504  /50x.html;
>        location = /50x.html {
>            root   /usr/local/www/nginx-dist;
>        }
>
>
>   }
>
>   server {
>        listen       11.11.11.11:80;
>        server_name  host2.net;
>        #charset koi8-r;
>        access_log  logs/host2.net.access.log main;
>
>        location / {
>            root   /home/m1emuz/public_html;
>            index  index.html index.htm index.php;
>        }
>
>        # serve static files directly
>        location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|flv|zip|mp3)$ {
>            root              /home/m1emuz/public_html;
>            access_log        off;
>            expires           30d;
>        }
>
>        location / {
>            proxy_pass        http://localhost:8000/;
>            proxy_redirect    off;
>            proxy_set_header  X-Forwarded-For
> $proxy_add_x_forwarded_for;
>            proxy_set_header  X-Real-IP  $remote_addr;
>            proxy_set_header  Host $http_host;
>
>        }
>
>        # redirect server error pages to the static page /50x.html
>        #
>        error_page   500 502 503 504  /50x.html;
>        location = /50x.html {
>            root   /usr/local/www/nginx-dist;
>        }
>
>
>   }
>
> }
>
>
> this is the full new config. i understand the 'root' and 'location'
> directives now, but idon't understand, why accessing host2.net, brings
> me to host1.com folder. i know that once the first match is done, the
> query stops, but it's virtual host. and i don't understand why the  
> files
> are not served from
> /home/m1emuz/public_html
> -- 
> Posted via http://www.ruby-forum.com/.
>






More information about the nginx mailing list