#156 closed defect (worksforme)
Virtualhost randomly displaying incorrect output
Reported by: | Ben Maynard | Owned by: | somebody |
---|---|---|---|
Priority: | critical | Milestone: | |
Component: | nginx-core | Version: | 1.0.x |
Keywords: | Cc: | ||
uname -a: | Linux mgi-ric-nebulaweb1.mgcorp.net 2.6.32-220.7.1.el6.x86_64 #1 SMP Fri Feb 10 15:22:22 EST 2012 x86_64 x86_64 x86_64 GNU/Linux | ||
nginx -V: |
nginx version: nginx/1.0.15
built by gcc 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) TLS SNI support enabled configure arguments: --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 --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --with-ld-opt=-Wl,-E |
Description
I have a somewhat complex environment:
GTM frontend Redirects to
LTM redirects to
load balanced varnish with
6 nginx backends, serving about 80 virtual hosts using uwsgi to serve django sites.
The problem I have is randomly a site will display the page of a random virtualhost (there doesn't appear to be any consistency in which site it may display), additionally on occasion it will simply display a random image from a page rather than the full page.
My nginx.conf file is:
user nginx;
worker_processes 2;
worker_rlimit_nofile 32768;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 4096;
use epoll;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
expires -1;
server_tokens off;
tcp_nopush on;
tcp_nodelay on;
client_max_body_size 50m;
server_names_hash_bucket_size 128;
server_names_hash_max_size 1024;
keepalive_timeout 65;
types_hash_max_size 2048;
server_name_in_redirect off
gzip on;
gzip_types application/x-javascript application/javascript text/xml text/css text/plain;
gzip_vary on;
gzip_proxied any;
gzip_disable "MSIE [1-6] \.";
log_format hostcombined '$server_name $remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';
access_log /var/log/nginx/access.log hostcombined;
error_log /var/log/nginx/error.log info;
upstream uwsgi_upstream {
server unix:/var/run/uwsgi/uwsgi.sock;
}
# Load config files from the /etc/nginx/conf.d directory
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*.conf;
}
My virtual hosts are stored in a domain per file and all are identical other than the paths, and server_names:
server {
listen 80;
server_name www2.example.com stage2.example.com origin-www2.example.com beta2.example.com;
access_log /var/log/nginx/access_example.com_log main;
root /srv/www/cms/clusters/mid_south/sites/example_com/site-media
location /{
uwsgi_pass uwsgi_upstream;
include uwsgi_params;
uwsgi_param UWSGI_SCRIPT deploy.mod_wsgi:WSGIHandler();
uwsgi_param UWSGI_CHDIR /srv/www/cms/clusters/mid_south/sites/example_com;
uwsgi_param UWSGI_SETENV DJANGO_SETTING_MODULE=settings;
}
location /site-media {
alias /srv/www/cms/clusters/mid_south/sites/example_com/site-media;
expires 2h;
}
}
Attachments (1)
Change History (6)
by , 13 years ago
Attachment: | nginx.conf added |
---|
comment:1 by , 13 years ago
comment:2 by , 13 years ago
The log files, when I track through all the logs up until I reach nginx they are displaying the correct virtual host, when I get to nginx it is logging the wrong vhost when I get an incorrect page displayed.
comment:3 by , 13 years ago
I.e. you see a request in nginx logs, but $server_name logged doesn't match what you expect for the request, right? You might want to provide the logs in question for us to see the problem as well.
Additional question is what's in request headers nginx got (you may try logging $http_host to see it with minimal overhead).
comment:4 by , 13 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Feedback timeout. Still no data provided to conclude there is a problem in nginx.
comment:5 by , 12 years ago
I've seen similar behaviour and was confused by the messages like this:
2013/03/02 22:00:14 [error] 15931#0: *179948 open() "/var/www/abc.com/favicon.ico" failed (2: No such file or directory), client: 1.2.3.4, server: abc.com, request: "GET /favicon.ico HTTP/1.1", host: "def.com"
I did have def.com server and abc.com was my default server in nginx config. The reason was that only default server had ssl option, and all other didn't, so https request to def.com was going to abc.com. That can be your case too.
And what makes you think the problem is in nginx?