Listen unix socket

Александр Сытар sytar.alex на gmail.com
Сб Фев 27 11:51:56 MSK 2010


Хочется странного - слушать unix socket. Попробовал в лоб:

## images server
server {
	listen unix:/var/lib/nginx/backend.socket:;

	access_log  off;
	error_log	logs/images.error.log warn;

	root   /usr/share/nginx/www_images;

	keepalive_timeout 0;

	location /images/small {
	    alias /usr/share/nginx/www_images;
	    image_filter resize 200 200;
	    error_page 415 = @empty;
	}

	location /images {
	    alias /usr/share/nginx/www_images;
	    image_filter resize 500 500;
	    error_page	415 = @empty;
	}

	location @empty {
	    empty_gif;
	}
}

### end

Чтобы потом его спроксировать в www

## WWW main server
server {
	listen ip:port;
	server_name some_name;

	location /images/small {
	    access_log off;
	    proxy_pass                  http://unix:/var/lib/nginx/backend.socket:;

	    proxy_cache                 image-preview;
	    proxy_cache_key             "$host$document_uri";

	    proxy_cache_valid           200 30d;
	    expires		30d;
	    gzip_proxied     expired no-cache no-store private auth;
	    add_header  Cache-Control  private;
	    proxy_ignore_client_abort off;
	}

	location /images {
	    access_log off;
	    proxy_pass                  http://unix:/var/lib/nginx/backend.socket:;

	    proxy_cache                 image-preview;
	    proxy_cache_key             "$host$document_uri";

	    proxy_cache_valid           200 30d;

	    expires      30d;
	    add_header  Cache-Control  private;
	    gzip_proxied     expired no-cache no-store private auth;
	    proxy_ignore_client_abort off;
	}

}
### end


Тест говорит что конфигурация  - ок, при релаоде сокет создаётся,
однако в логах появляется
2010/02/27 11:28:37 [notice] 14327#0: signal process started
2010/02/27 11:28:45 [emerg] 15407#0: bind() to  failed (98: Address
already in use)
2010/02/27 11:28:45 [emerg] 15407#0: bind() to  failed (98: Address
already in use)
2010/02/27 11:28:45 [emerg] 15407#0: bind() to  failed (98: Address
already in use)
2010/02/27 11:28:45 [emerg] 15407#0: bind() to  failed (98: Address
already in use)
2010/02/27 11:28:45 [emerg] 15407#0: bind() to  failed (98: Address
already in use)
2010/02/27 11:28:45 [emerg] 15407#0: still could not bind()
2010/02/27 11:29:02 [emerg] 15533#0: bind() to  failed (98: Address
already in use)
2010/02/27 11:29:02 [emerg] 15533#0: bind() to  failed (98: Address
already in use)
2010/02/27 11:29:02 [emerg] 15533#0: bind() to  failed (98: Address
already in use)
2010/02/27 11:29:02 [emerg] 15533#0: bind() to  failed (98: Address
already in use)
2010/02/27 11:29:02 [emerg] 15533#0: bind() to  failed (98: Address
already in use)
2010/02/27 11:29:02 [emerg] 15533#0: still could not bind()


# nginx -V
nginx version: nginx/0.7.65
configure arguments: --with-cc-opt='-O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables' --user=nginx --group=nginx
--prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log
--http-client-body-temp-path=/var/lib/nginx/tmp/client_body
--http-proxy-temp-path=/var/lib/nginx/tmp/proxy
--http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi
--pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx
--with-http_flv_module --with-http_stub_status_module
--with-http_geoip_module --with-http_image_filter_module --with-debug
--with-rtsig_module --without-http_memcached_module --with-mail
--without-http_ssi_module --without-http_autoindex_module
--without-http_referer_module --without-http_memcached_module
--without-http_limit_zone_module --without-http_limit_req_module
--with-http_gzip_static_module



Подробная информация о списке рассылки nginx-ru