Проблемы с добавление виртуал-хоста к nginx

Yaroslav yarik at muravskiy.kiev.ua
Tue Jan 29 13:05:37 MSK 2008


umask пишет:
> нужны конфиг nginx'а и вывод команды `ip a'.
>
>
>
> 29.01.08, 12:23, "Yaroslav" <yarik at muravskiy.kiev.ua>:
>
>
>
>   
>> Здравствуйте, возникла проблема при добавлении второго 
>>     
>
>   
>> виртуального-хоста в nginx, на втором ИП адресе.  nginx не может 
>>     
>
>   
>> стартовать. В логах следующая ошибка:
>>     
>
>   
>> bind() to 192.168.0.2:80 failed (99: Cannot assign requested address)
>>     
>
>   
>> Буду благодарен за любую помощь.
>>     
>
>   
>> PS.
>>     
>
>   
>> Пробовал echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle не помогло
>>     
>
>   
>> ОС: Fedora 7
>>     
>
>
>   
Конфиг nginx'а:

user apache apache;
worker_processes  1;
worker_rlimit_nofile 40000;

error_log  /var/log/nginx/error.log;

pid        /var/run/nginx/nginx.pid;

events {
    worker_connections  25000;
}

http {
    include       /usr/local/nginx/etc/mime.types;
    default_type  application/octet-stream;

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


    access_log  /var/log/nginx/access.log  main;

    limit_zone   one  $binary_remote_addr  10m;
    limit_conn   one  7;
    limit_rate         512K;

    client_header_timeout       60;
    client_body_timeout         60;
    send_timeout                120;
    proxy_read_timeout          60;
    proxy_connect_timeout       60;
    proxy_send_timeout          180;

    msie_padding                on;

    proxy_buffer_size           32K;
    proxy_buffers               64 512K;
    proxy_busy_buffers_size     1024K;
    proxy_temp_file_write_size  1024K;

    gzip on;
    gzip_min_length  10240;
    gzip_buffers     32 64k;
    gzip_types       text/html application/x-javascript text/css 
text/xml text/plain;

    client_header_buffer_size   4K;
    client_max_body_size        100000000;
    large_client_header_buffers 16 8K;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;

    output_buffers   32 256k;
    postpone_output  1460;

    lingering_time     30;
    lingering_timeout  6;
    reset_timedout_connection  on;

    keepalive_timeout  20;

    server_names_hash_bucket_size 64;
server {
        listen       192.168.0.1:80 default rcvbuf=8192 sndbuf=16384 
backlog=32000;
        server_name server.domain.com;
        access_log  /var/log/httpd/access_log  main;
        error_log   /var/log/httpd/domains/access_log info;
        error_log   /var/log/httpd/domains/error_log notice;
        location / {
                    proxy_pass         http://192.168.0.1:8080/;
                    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;
                }

        #Static files location
        location ~* 
^.+\.(jpg|jpeg|gif|mp3|png|avi|vob|mpg|mpeg|mp4|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js)$ 
{
            root /var/www/html;
        }
    }
server {
        listen       192.168.0.2:80;
        server_name  domain2.com www.domain2.com;
        access_log /var/log/httpd/domains/domain2.com.log  main;
        error_log  /var/log/httpd/domains/domain2.com.error.log info;
        error_log  /var/log/httpd/domains/domain2.com.error.log notice;
        location / {
                        proxy_pass         http://192.168.0.2:8080/;
                        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;
                    }

        #Static files location
location ~* 
^.+\.(jpg|jpeg|gif|mp3|html|png|avi|vob|mpg|mpeg|mp4|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js)$ 
{
            root /home/domain2.com/public_html;
        }
}
}
Вывод команды ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast 
qlen 1000
    link/ether 00:e0:81:5b:17:7e brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.1/23 brd 195.189.227.255 scope global eth0
    inet 192.168.0.2/23 brd 195.189.227.255 scope global secondary eth0:1
    inet6 fe80::2e0:81ff:fe5b:177e/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast 
qlen 1000
    link/ether 00:e0:81:5b:17:7f brd ff:ff:ff:ff:ff:ff
    inet 10.11.11.20/24 brd 10.11.11.255 scope global eth1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx-ru/attachments/20080129/228f1a0f/attachment.html>


More information about the nginx-ru mailing list