NGINX stops redirecting
Douglas Landau
DouglasL at westmarine.com
Mon May 8 22:25:57 UTC 2017
This is CentOS 7. My /etc/hosts file:
[root at dwswiki10 nginx]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#127.0.1.1 dwswiki10.westmarine.net dwswiki10
10.13.4.247 dwswiki10.westmarine.net dwswiki10
I must confess I don't understand the 127.0.1.1 line that I commented out.
Thanks
Doug
BTW Are my nginx/conf/nginx.conf and nginx/conf.d/tomcat.conf "server" sections both correct? One says localhost where the other has a fully qualified hostname, but also they both have two "server" sections. Was I supposed to stop using / comment out the two server sections in conf/nginx.conf when I added conf.d/tomcat.conf?
My conf/nginx.conf:
[root at dwswiki10 conf]# more nginx.conf
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
server {
listen 443 ssl;
server_name localhost;
ssl_certificate /data/nginx/keys/dwswiki10.westmarine.net.pem;
ssl_certificate_key /data/nginx/keys/dwswiki10.westmarine.net.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
}
include ../conf.d/*.conf;
}
My nginx/conf.d/tomcat.conf:
[root at dwswiki10 nginx]# cat conf.d/tomcat.conf
server {
listen 80;
server_name dwswiki10.westmarine.net;
# Root to the XWiki application
root /data/tomcat/webapps/xwiki;
location / {
#All "root" requests will have /xwiki appended AND redirected to mydomain.com again
rewrite ^ $scheme://$server_name/xwiki$request_uri? permanent;
}
location ^~ /xwiki {
# If path starts with /xwiki - then redirect to backend: XWiki application in Tomcat
# Read more about proxy_pass: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass
proxy_pass http://localhost:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
listen 443;
server_name dwswiki10.westmarine.net;
# Root to the XWiki application
root /data/tomcat/webapps/xwiki;
location / {
#All "root" requests will have /xwiki appended AND redirected to mydomain.com again
rewrite ^ $scheme://$server_name/xwiki$request_uri? permanent;
}
location ^~ /xwiki {
# If path starts with /xwiki - then redirect to backend: XWiki application in Tomcat
# Read more about proxy_pass: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass
proxy_pass http://localhost:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
From: Douglas Landau
Sent: Monday, May 08, 2017 3:18 PM
To: 'nginx at nginx.org'
Subject: NGINX stops redirecting
For some reason NGINX sometimes stops serving my tomcat pages and starts wanting to serve pages from .../nginx/html/.
I don't get it. On Friday, at 13:39, I was happily browsing my XWiki site, as you can see from the NGINX access_log. Then from that log you see no activity until 10:31 this morning, at which time it no longer wants to redirect hits to port 8080 or to /xwiki, it just wants to serve from its own html/ subdir.
When I come in this morning, When I go to hit the site NGINX shows me the placeholder page, .../nginx/html/index.html, which starts out "If you can see this page, ..."
I can still hit my xwiki at :8080/xwiki. It has not been restarted, altho so what if it had?
NGINX has not been restarted, and the config files (conf/nginx.conf, conf.d/tomcat.conf) have not changed.
Anybody else seen this? Why did it change behavior, and doe it have anything to do with the "signal process started" messages?
Thanks. Sorry if this is already discussed I just now koined the mailing list and will look thru the archives now.
NGINX Access log, showing a few hits to xwiki at 13:39 on 05/05, then non-redirected hits at 10:31-10:41 AM on 05/08
------------------
10.13.107.52 - - [05/May/2017:13:39:39 -0700] "GET /xwiki/bin/get/Portfolio%20Management/Project%20Budget/WebHome?outputSyntax=plain&sheet=XWiki.DocumentTree&showAttachments=false&showTranslations=false&&data=children&id=document%3Axwiki%3APortfolio+Management.WebHome HTTP/1.1" 200 1671 "http://dwswiki10.westmarine.net/xwiki/bin/view/Portfolio%20Management/Project%20Budget/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"
10.13.107.52 - - [05/May/2017:13:39:41 -0700] "GET /xwiki/bin/get/Portfolio%20Management/Project%20Budget/WebHome?outputSyntax=plain&sheet=XWiki.DocumentTree&showAttachments=false&showTranslations=false&&data=children&id=document%3Axwiki%3APortfolio+Management.Projects.WebHome HTTP/1.1" 200 1178 "http://dwswiki10.westmarine.net/xwiki/bin/view/Portfolio%20Management/Project%20Budget/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"
10.13.107.52 - - [05/May/2017:13:39:43 -0700] "GET /xwiki/bin/get/Portfolio%20Management/Project%20Budget/WebHome?outputSyntax=plain&sheet=XWiki.DocumentTree&showAttachments=false&showTranslations=false&&data=children&id=document%3Axwiki%3APortfolio+Management.Projects.Project+A.WebHome HTTP/1.1" 200 4330 "http://dwswiki10.westmarine.net/xwiki/bin/view/Portfolio%20Management/Project%20Budget/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"
10.13.107.52 - - [05/May/2017:13:39:45 -0700] "GET /xwiki/bin/get/Portfolio%20Management/Project%20Budget/WebHome?outputSyntax=plain&sheet=XWiki.DocumentTree&showAttachments=false&showTranslations=false&&data=children&id=document%3Axwiki%3APortfolio+Management.Projects.Project+A.Design.WebHome HTTP/1.1" 200 6935 "http://dwswiki10.westmarine.net/xwiki/bin/view/Portfolio%20Management/Project%20Budget/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"
10.13.107.52 - - [08/May/2017:10:30:44 -0700] "GET / HTTP/1.1" 200 612 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"
10.13.107.52 - - [08/May/2017:10:30:45 -0700] "GET /favicon.ico HTTP/1.1" 404 571 "http://dwswiki10/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"
10.13.107.52 - - [08/May/2017:10:31:27 -0700] "GET /xwiki HTTP/1.1" 404 571 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"
10.13.107.52 - - [08/May/2017:10:31:44 -0700] "GET / HTTP/1.1" 200 612 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"
10.13.107.52 - - [08/May/2017:10:31:44 -0700] "GET /favicon.ico HTTP/1.1" 404 571 "https://dwswiki10/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"
10.13.107.52 - - [08/May/2017:10:41:26 -0700] "GET / HTTP/1.1" 200 612 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)"
10.13.107.52 - - [08/May/2017:10:41:26 -0700] "GET /favicon.ico HTTP/1.1" 404 571 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)"
10.13.107.52 - - [08/May/2017:10:41:29 -0700] "GET / HTTP/1.1" 304 0 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)"
10.13.107.52 - - [08/May/2017:10:41:29 -0700] "GET /favicon.ico HTTP/1.1" 404 571 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)"
NGINX error log, showing some " signal process started" messages:
--------------------------------
2017/05/05 00:27:05 [error] 14431#0: *6148 open() "/data/nginx/html/servlet/admin" failed (2: No such file or directory), client: 10.13.122.42, server: localhost, request: "GET /servlet/admin?category=server&method=listAll&Authorization=Digest+username%3D%22admin%22%2C+response%3D%22ae9f86d6beaa3f9ecb9a5b7e072a4138%22%2C+nonce%3D%222b089ba7985a883ab2eddcd3539a6c94%22%2C+realm%3D%22adminRealm%22%2C+uri%3D%22%2Fservlet%2Fadmin%22&service= HTTP/1.0"
2017/05/05 00:27:05 [error] 14431#0: *6152 open() "/data/nginx/html/servlet/admin" failed (2: No such file or directory), client: 10.13.122.42, server: localhost, request: "GET /servlet/admin?category=server&method=listAll&Authorization=Digest+username%3D%22admin%22%2C+response%3D%22ae9f86d6beaa3f9ecb9a5b7e072a4138%22%2C+nonce%3D%222b089ba7985a883ab2eddcd3539a6c94%22%2C+realm%3D%22adminRealm%22%2C+uri%3D%22%2Fservlet%2Fadmin%22&service= HTTP/1.0"
2017/05/05 00:27:05 [error] 14431#0: *6156 "/data/nginx/html/HTTP1.0/index.html" is not found (2: No such file or directory), client: 10.13.122.42, server: localhost, request: "GET /HTTP1.0/"
2017/05/05 00:27:12 [error] 14431#0: *6443 open() "/data/nginx/html/home.htm" failed (2: No such file or directory), client: 10.13.122.42, server: localhost, request: "GET /home.htm HTTP/1.1", host: "10.13.4.247"
2017/05/05 00:27:16 [error] 14431#0: *6550 open() "/data/nginx/html/spipe" failed (2: No such file or directory), client: 10.13.122.42, server: localhost, request: "POST /spipe?Source=nessus HTTP/1.0"
2017/05/05 00:27:16 [error] 14431#0: *6552 open() "/data/nginx/html/spipe" failed (2: No such file or directory), client: 10.13.122.42, server: localhost, request: "POST /spipe?Source=nessus HTTP/1.0"
2017/05/05 00:27:20 [error] 14431#0: *6661 open() "/data/nginx/html/logout" failed (2: No such file or directory), client: 10.13.122.42, server: localhost, request: "GET /logout HTTP/1.0"
2017/05/05 00:27:20 [error] 14431#0: *6668 open() "/data/nginx/html/logout" failed (2: No such file or directory), client: 10.13.122.42, server: localhost, request: "GET /logout HTTP/1.0"
2017/05/05 00:27:22 [error] 14431#0: *6752 open() "/data/nginx/html/yYWiy2DH.asp" failed (2: No such file or directory), client: 10.13.122.42, server: localhost, request: "GET //yYWiy2DH.asp HTTP/1.0"
2017/05/05 00:27:22 [error] 14431#0: *6757 open() "/data/nginx/html/tnq0ObbP.asp" failed (2: No such file or directory), client: 10.13.122.42, server: localhost, request: "GET //tnq0ObbP.asp HTTP/1.0"
2017/05/05 00:27:25 [error] 14431#0: *6882 open() "/data/nginx/html/content/YmEIoHwZQ6.mp3" failed (2: No such file or directory), client: 10.13.122.42, server: localhost, request: "GET /content/YmEIoHwZQ6.mp3 HTTP/1.0"
2017/05/05 00:27:25 [error] 14431#0: *6885 open() "/data/nginx/html/content/YmEIoHwZQ6.mp3" failed (2: No such file or directory), client: 10.13.122.42, server: localhost, request: "GET /content/YmEIoHwZQ6.mp3 HTTP/1.0"
2017/05/05 00:27:46 [error] 14431#0: *7313 open() "/data/nginx/html/iControl/iControlPortal.cgi" failed (2: No such file or directory), client: 10.13.122.42, server: localhost, request: "POST http://127.0.0.1/iControl/iControlPortal.cgi HTTP/1.1", host: "dwswiki10.westmarine.net"
2017/05/05 00:27:46 [error] 14431#0: *7315 open() "/data/nginx/html/iControl/iControlPortal.cgi" failed (2: No such file or directory), client: 10.13.122.42, server: localhost, request: "POST http://127.0.0.1/iControl/iControlPortal.cgi HTTP/1.1", host: "dwswiki10.westmarine.net"
2017/05/05 00:27:47 [error] 14431#0: *7342 open() "/data/nginx/html/.anydomain.test" failed (2: No such file or directory), client: 10.13.122.42, server: localhost, request: "GET /.anydomain.test HTTP/1.0"
2017/05/05 00:27:47 [error] 14431#0: *7343 open() "/data/nginx/html/.anydomain.test" failed (2: No such file or directory), client: 10.13.122.42, server: localhost, request: "GET /.anydomain.test HTTP/1.0"
2017/05/05 00:27:47 [error] 14431#0: *7345 open() "/data/nginx/html/index.jsp" failed (2: No such file or directory), client: 10.13.122.42, server: localhost, request: "GET /index.jsp HTTP/1.1", host: "sjfklsjfkldfjklsdfjdlksjfdsljk.foo."
2017/05/05 00:27:48 [error] 14431#0: *7351 open() "/data/nginx/html/index.jsp" failed (2: No such file or directory), client: 10.13.122.42, server: localhost, request: "GET /index.jsp HTTP/1.1", host: "sjfklsjfkldfjklsdfjdlksjfdsljk.foo."
2017/05/05 00:27:50 [crit] 14431#0: *7396 SSL_do_handshake() failed (SSL: error:14094085:SSL routines:SSL3_READ_BYTES:ccs received early) while SSL handshaking, client: 10.13.122.42, server: 0.0.0.0:443
2017/05/05 00:27:50 [crit] 14431#0: *7397 SSL_do_handshake() failed (SSL: error:05066066:Diffie-Hellman routines:COMPUTE_KEY:invalid public key error:1408B005:SSL routines:SSL3_GET_CLIENT_KEY_EXCHANGE:DH lib) while SSL handshaking, client: 10.13.122.42, server: 0.0.0.0:443
2017/05/05 10:40:33 [notice] 20325#0: signal process started
2017/05/05 10:41:12 [notice] 20357#0: signal process started
2017/05/05 10:43:18 [notice] 20416#0: signal process started
2017/05/05 12:59:34 [notice] 23321#0: signal process started
2017/05/08 10:30:45 [error] 23325#0: *132 open() "/data/nginx/html/favicon.ico" failed (2: No such file or directory), client: 10.13.107.52, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "dwswiki10", referrer: "http://dwswiki10/"
2017/05/08 10:31:27 [error] 23325#0: *132 open() "/data/nginx/html/xwiki" failed (2: No such file or directory), client: 10.13.107.52, server: localhost, request: "GET /xwiki HTTP/1.1", host: "dwswiki10"
2017/05/08 10:31:44 [error] 23325#0: *140 open() "/data/nginx/html/favicon.ico" failed (2: No such file or directory), client: 10.13.107.52, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "dwswiki10", referrer: "https://dwswiki10/"
2017/05/08 10:40:43 [notice] 16545#0: signal process started
2017/05/08 10:41:26 [error] 16566#0: *1 open() "/data/nginx/html/favicon.ico" failed (2: No such file or directory), client: 10.13.107.52, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "dwswiki10"
2017/05/08 10:41:29 [error] 16566#0: *1 open() "/data/nginx/html/favicon.ico" failed (2: No such file or directory), client: 10.13.107.52, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "dwswiki10"
2017/05/08 10:42:26 [notice] 16651#0: signal process started
My conf/nginx.conf:
[root at dwswiki10 conf]# more nginx.conf
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
server {
listen 443 ssl;
server_name localhost;
ssl_certificate /data/nginx/keys/dwswiki10.westmarine.net.pem;
ssl_certificate_key /data/nginx/keys/dwswiki10.westmarine.net.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
}
include ../conf.d/*.conf;
}
My nginx/conf.d/tomcat.conf:
[root at dwswiki10 nginx]# cat conf.d/tomcat.conf
server {
listen 80;
server_name dwswiki10.westmarine.net;
# Root to the XWiki application
root /data/tomcat/webapps/xwiki;
location / {
#All "root" requests will have /xwiki appended AND redirected to mydomain.com again
rewrite ^ $scheme://$server_name/xwiki$request_uri? permanent;
}
location ^~ /xwiki {
# If path starts with /xwiki - then redirect to backend: XWiki application in Tomcat
# Read more about proxy_pass: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass
proxy_pass http://localhost:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
listen 443;
server_name dwswiki10.westmarine.net;
# Root to the XWiki application
root /data/tomcat/webapps/xwiki;
location / {
#All "root" requests will have /xwiki appended AND redirected to mydomain.com again
rewrite ^ $scheme://$server_name/xwiki$request_uri? permanent;
}
location ^~ /xwiki {
# If path starts with /xwiki - then redirect to backend: XWiki application in Tomcat
# Read more about proxy_pass: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass
proxy_pass http://localhost:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
The information contained in this transmission may contain West Marine proprietary, confidential and/or privileged
information. It is intended only for the use of the person(s) named above. If you are not the intended recipient, you are
hereby notified that any review, dissemination, distribution or duplication of this communication is strictly prohibited.
If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original
message. To reply to our email administrator directly, please send an email to netadmin at westmarine.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20170508/ca62806b/attachment-0001.html>
More information about the nginx
mailing list