I have a seperate docker container setup with Lesencrypt (using nginx, nginx-gen, nginx-letsencrypt)
The Nginx and app containers are working fine but I see errors in Docker logs for Nginx.
I have the volumes for nginx docker at:
- /srv/www/nginx-proxy/conf.d:/etc/nginx/conf.d
- /srv/www/nginx-proxy/vhost.d:/etc/nginx/vhost.d
- /srv/www/nginx-proxy/html:/usr/share/nginx/html
- /srv/www/nginx-proxy/certs:/etc/nginx/certs:ro
I see a lot of docker errors in Nginx Docker logs
Most of these errors are caused due to a missing files at /etc/nginx/html
:
2019-03-14T16:41:41.827406845Z 2019/03/14 16:41:41 [error] 10#10: *29 "/etc/nginx/html/index.html" is not found (2: No such file or directory), client: 162.220.108.178, server: , request: "GET / HTTP/1.1", host: "xx.187.124.124"
2019-03-14T16:41:44.058864267Z 2019/03/14 16:41:44 [error] 10#10: *30 "/etc/nginx/html/index.html" is not found (2: No such file or directory), client: 83.224.172.148, server: , request: "GET / HTTP/1.1", host: "xx.43.94.103:80"
2019-03-14T16:42:49.085729650Z 2019/03/14 16:42:49 [error] 10#10: *37 "/etc/nginx/html/index.html" is not found (2: No such file or directory), client: 164.52.24.163, server: , request: "GET / HTTP/1.1", host:"xx.187.124.124"
2019-03-14T16:47:50.012585507Z 2019/03/14 16:47:50 [error] 10#10: *58 open() "/etc/nginx/html/.well-known/acme-challenge/7mwlZRBfqpmjH1XKH-Qg7B6lyduFU9EPg4QSaTFyT0s" failed (2: No such file or directory), client: 66.133.109.36, server: , request: "GET /.well-known/acme-challenge/7mwlZRBfqpmjH1XKH-Qg7B6lyduFU9EPg4QSaTFyT0s HTTP/1.1", host: "foo.bar"
These are the same with other Docker applications that are deployed.
Say we have a Wordpress Docker deployed with volumes
- ./wordpress:/var/www/html
Or say we have a server block setup for external load balancer such as ALB/CloudFront/CloudFlare, this is important for us to mitigate docker errors for these external load balancers to failover to other servers in the event of a server failure.
I see errors for missing files at /etc/nginx/html/
like the below:
2019-03-14T05:38:06.284529777Z 2019/03/14 05:38:06 [error] 11#11: *689 "/etc/nginx/html/index.html" is not found (2: No such file or directory), client: 78.162.82.29, server: , request: "GET / HTTP/1.1", host:"alb-aws-com" 2019-03-14T06:57:03.020160983Z 2019/03/14 06:57:03 [error] 11#11: *1011 open() "/etc/nginx/html/wp-config.php" failed (2: No such file or directory), client: 190.188.94.38, server: , request: "GET /wp-config.php HTTP/1.1", host: "xxx.187.124.124" 2019-03-14T06:57:03.020160983Z 2019/03/14 06:57:03 [error] 11#11: *1011 open() "/etc/nginx/html/wp-config.php" failed (2: No such file or directory), client: 190.188.94.38, server: , request: "GET /wp-config.php HTTP/1.1", host: "xx.187.124.124" 2019-03-14T06:57:13.402392385Z 2019/03/14 06:57:13 [error] 11#11: *1011 open() "/etc/nginx/html/wp-admins.php" failed (2: No such file or directory), client: 190.188.94.38, server: , request: "POST /wp-admins.php HTTP/1.1", host: "xx.187.124.124" 2019-03-14T06:57:13.402392385Z 2019/03/14 06:57:13 [error] 11#11: *1011 open() "/etc/nginx/html/wp-admins.php" failed (2: No such file or directory), client: 190.188.94.38, server: , request: "POST /wp-admins.php HTTP/1.1", host: "xx.187.124.124" 2019-03-14T06:58:20.069384814Z 2019/03/14 06:58:20 [error] 11#11: *1018 open() "/etc/nginx/html/wp-content/plugins/portable-phpmyadmin/wp-pma-mod/index.php" failed (2: No such file or directory), client: 190.188.94.38, server: , request: "GET /wp-content/plugins/portable-phpmyadmin/wp-pma-mod/index.php HTTP/1.1", host: "xx.187.124.124" 2019-03-14T06:58:20.069384814Z 2019/03/14 06:58:20 [error] 11#11: *1018 open() "/etc/nginx/html/wp-content/plugins/portable-phpmyadmin/wp-pma-mod/index.php" failed (2: No such file or directory), client: 190.188.94.38, server: , request: "GET /wp-content/plugins/portable-phpmyadmin/wp-pma-mod/index.php HTTP/1.1", host: "xx.187.124.124" 2019-03-14T06:58:20.069384814Z 2019/03/14 06:58:20 [error] 11#11: *1018 open() "/etc/nginx/html/wp-content/plugins/portable-phpmyadmin/wp-pma-mod/index.php" failed (2: No such file or directory), client: 190.188.94.38, server: , request: "GET /wp-content/plugins/portable-phpmyadmin/wp-pma-mod/index.php HTTP/1.1", host: "xx.187.124.124"
Below are the Nginx and sample webapp(foo.bar) server blocks that are created automatically by the Dockers:
server {
server_name _; # This is just an invalid value which will never trigger on a real hostname.
listen 80;
access_log /var/log/nginx/access.log vhost;
return 503;
}
server {
server_name _; # This is just an invalid value which will never trigger on a real hostname.
listen 443 ssl http2;
access_log /var/log/nginx/access.log vhost;
return 503;
ssl_session_tickets off;
ssl_certificate /etc/nginx/certs/default.crt;
ssl_certificate_key /etc/nginx/certs/default.key;
}
server {
server_name foo.bar;
listen 80 ;
access_log /var/log/nginx/access.log vhost;
include /etc/nginx/vhost.d/default;
location / {
proxy_pass http://foo.bar;
}
}
server {
server_name foo.bar;
listen 443 ssl http2 ;
access_log /var/log/nginx/access.log vhost;
return 500;
ssl_certificate /etc/nginx/certs/default.crt;
ssl_certificate_key /etc/nginx/certs/default.key;
}
Am I missing something or should we consider these errors normal?
Is there a way to get rid of these errors?