segmentation fault with include and virtual hosts

Igor Sysoev is at rambler-co.ru
Tue Apr 17 00:42:27 MSD 2007


On Mon, Apr 16, 2007 at 10:36:48PM +0200, Manlio Perillo wrote:

> Igor Sysoev ha scritto:
> >On Mon, Apr 16, 2007 at 08:31:21PM +0200, Manlio Perillo wrote:
> >
> >>I'm using nginx 0.5.13, with Debian Etch (the package from testing).
> >>
> >>I'm tryng to organize my configuration files using the
> >>sites-available/sites-enabled directories.
> >>
> >>Here is the main config file (nginx.conf):
> >>
> >>user www-data;
> >>worker_processes  1;
> >>
> >>error_log  /var/log/nginx/error.log;
> >>pid        /var/run/nginx.pid;
> >>
> >>events {
> >>    use epoll;
> >>    worker_connections  1024;
> >>}
> >>
> >>http {
> >>    include       /etc/nginx/mime.types;
> >>    default_type  application/octet-stream;
> >>
> >>    access_log	/var/log/nginx/access.log;
> >>
> >>    sendfile        on;
> >>    #tcp_nopush     on;
> >>
> >>    #keepalive_timeout  0;
> >>    keepalive_timeout  65;
> >>    tcp_nodelay        on;
> >>
> >>    gzip  on;
> >>}
> >>
> >>include /etc/nginx/sites-enabled/*;
> >>
> >>
> >>
> >>When I include two virtual host:
> >>
> >>sites-available/1:
> >>
> >>http {
> >>    server {
> >>        listen       80;
> >>        server_name  localhost;
> >>
> >>        access_log  /var/log/nginx/localhost.access.log;
> >>
> >>        location / {
> >>            root   /var/www/nginx-default;
> >>            index  index.html index.htm;
> >>        }
> >>
> >>        #error_page  404              /404.html;
> >>
> >>        # redirect server error pages to the static page /50x.html
> >>        #
> >>        error_page   500 502 503 504  /50x.html;
> >>        location = /50x.html {
> >>            root   /var/www/nginx-default;
> >>        }
> >>    }
> >>}
> >>
> >>sites-available/2:
> >>http {
> >>    server {
> >>        listen       80;
> >>        server_name  munin.localhost;
> >>
> >>        location / {
> >>            root /var/www/munin/;
> >>            autoindex on;
> >>        }
> >>    }
> >>}
> >>
> >>I got a:
> >>
> >>Starting nginx: /etc/init.d/nginx: line 27: 22905 Segmentation fault 
> >>  start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid --exec 
> >>$DAEMON -- $DAEMON_OPTS
> >>
> >>
> >>This does not happen if I put the include inside the http directive (and 
> >>removing the http directive from the sub configuration files).
> >
> >This is bug in nginx. I will fix it. However, there can be the only http
> >block - you should include servers only without http {}.
> >
> 
> Ok, thanks.
> 
> However this is a problem, since 'upstream'  directive must go inside 
> the 'http' directive.
> This means that I can't put it in my available-sites (well, not a real 
> problem...).

You may - sites-available/N:
--------------
upstream {
    ...
}

server {
    ...
}
--------------


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list