Re: научите пересобирать NGINX с нужными модулями

in_ukraine nginx-forum на nginx.us
Вт Апр 3 08:58:02 UTC 2012


IP и имена доменов изменены

server {
		listen 11.11.11.11:80;
		server_name mysite.ru www.mysite.ru;
		location ~* ^/(awstats/|webmail/|phpmyadmin/|server-status/|backups/)
{
			proxy_pass http://11.11.11.11:8080;
			proxy_redirect http://mysite.ru:8080/ /;
			proxy_set_header Host $host;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			proxy_set_header X-Real-IP $remote_addr;
		}
		location / {
			proxy_pass http://11.11.11.11:8080;
			proxy_redirect http://mysite.ru:8080/ /;
			proxy_set_header Host $host;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			proxy_set_header X-Real-IP $remote_addr;
		}
		location ~*
^.+\.(jpg|jpeg|gif|png|tiff|svg|eps|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|wav|tar|exe|wmv|ico|tgz|mid|midi|bmp|flv|swf)$
{
			access_log /var/www/logs/mysite.ru.access_nginx.log;
			error_page 404 = @fallback;
			set $droot "/var/www/mysite.ru";
			if ( $host = "mysite.ru" ) {
				break;
			}
			if ( $host = "www.mysite.ru" ) {
				break;
			}
			if ( $host ~* ^(.*).mysite.ru$ ) {
				set $proot /var/www/mysite.ru/$1;
				break;
			}

			root $droot;
		}
		location /block {
			auth_basic "Restricted";
			auth_basic_user_file /var/www/mysite.ru/block/.htpasswd;
	       }
		location @fallback {
			proxy_pass http://11.11.11.11:8080;
			proxy_set_header Host $host;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			proxy_set_header X-Real-IP $remote_addr;
		}
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?21,224781,224831#msg-224831



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