Trouble with VHosts
grmbl
nginx-forum at nginx.us
Fri Nov 6 14:08:25 MSK 2009
Hello,
As helpful and nice people in this mailing list seem to ignore my previous message, let's try to ask about a different problem. :-)
nginx 0.8.22
-- configure options:
./configure --prefix=/u01/nginx --http-log-path=/var/log/nginx-access.log \
--http-client-body-temp-path=/u02/nginx-client-temp \
--http-proxy-temp-path=/u02/nginx-proxy-temp \
--http-fastcgi-temp-path=/u02/nginx-fcgi-temp \
--error-log-path=/var/log/nginx-error.log \
--pid-path=/var/run/nginx.pid
VHosts trouble. Supposed to be:
[*] (www.)site.com -> proxied to local Apache at 8181
[*] bs.site.com -> proxied to local Apache at 8282
Does not work, always proxies to 8181.
I've tried like a gazillion of configurations, here's the latest one:
-------------------
# ==================================
# UPSTREAMS
# ==================================
upstream main {
server localhost:8181;
}
upstream bs {
server localhost:8282;
}
# ==================================
# BANNERS
# ==================================
server {
listen 80;
server_name bs.site.com;
location / {
proxy_redirect off;
proxy_pass http://bs/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /u01/nginx/html;
}
location ~ /\.ht {
deny all;
}
include /u01/nginx/conf/proxy.conf;
}
# ==================================
# MAIN SITE
# ==================================
proxy_cache_path /u02/nginx-cache-one levels=1:2 keys_zone=one:16m max_size=100m;
proxy_temp_path /u02/nginx-temp;
server {
listen 80;
server_name site.com www.site.com;
location /i/ {
root /u01/web/site.com/www-root/i;
access_log off;
expires 1d;
}
location /get/ {
proxy_redirect off;
proxy_cache one;
proxy_cache_valid 30s;
proxy_pass http://main/;
}
location /torrent/ {
proxy_redirect off;
proxy_cache off;
proxy_pass http://main/;
}
location / {
proxy_cache one;
proxy_cache_valid 2m;
proxy_redirect off;
proxy_pass http://main/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /u01/nginx/html;
}
location ~ /\.ht {
deny all;
}
include /u01/nginx/conf/proxy.conf;
}
-------------------
/u01/nginx/conf/proxy.conf;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Host $host;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 30;
proxy_send_timeout 30;
proxy_read_timeout 30;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
-------------------
nginx.conf:
user nobody nogroup;
worker_processes 2;
events {
worker_connections 1024;
use epoll;
}
http {
server_name_in_redirect off;
server_tokens off;
include mime.types;
default_type application/octet-stream;
sendfile on;
gzip on;
gzip_min_length 1024;
gzip_types text/plain,text/html,application/xml,application/json,application/vnd.php.serialized,text/xml,application/rss;
output_buffers 1 32k;
postpone_output 1460;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 60;
include /u01/web/*.conf;
}
-------------------
Please help, I'm on the edge of killing myself. :-)
--
Pavel
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,20567,20567#msg-20567
More information about the nginx
mailing list