fix: move error log to stderr globally
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2023-09-25 00:35:09 +02:00
parent 3d71062d4b
commit 3ee6e3c6ff
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
3 changed files with 13 additions and 13 deletions

View File

@ -38,7 +38,7 @@ RUN mkdir -p /var/www /etc/nginx-s3 /etc/nginx/conf.d /var/tmp/nginx /var/cache/
touch /run/nginx.pid && \ touch /run/nginx.pid && \
touch /etc/nginx/conf.d/vhosts.conf && \ touch /etc/nginx/conf.d/vhosts.conf && \
chown nginx /run/nginx.pid && \ chown nginx /run/nginx.pid && \
chown -R nginx /var/log/nginx /var/tmp/nginx /var/cache/nginx && \ chown -R nginx /var/tmp/nginx /var/cache/nginx && \
chown -R nginx:nginx /var/www && \ chown -R nginx:nginx /var/www && \
chown -R root:nginx /etc/nginx /etc/nginx/conf.d && \ chown -R root:nginx /etc/nginx /etc/nginx/conf.d && \
chmod -R 640 /etc/nginx /etc/nginx/conf.d && \ chmod -R 640 /etc/nginx /etc/nginx/conf.d && \

View File

@ -1,21 +1,21 @@
worker_processes 1; worker_processes 1;
pid /var/run/nginx.pid; pid /var/run/nginx.pid;
error_log stderr error;
events { events {
worker_connections 1024; worker_connections 1024;
} }
http { http {
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
default_type application/octet-stream; default_type application/octet-stream;
sendfile on; sendfile on;
tcp_nopush on; tcp_nopush on;
tcp_nodelay on; tcp_nodelay on;
keepalive_timeout 65; keepalive_timeout 65;
server_tokens off; server_tokens off;
access_log off; access_log off;
error_log /dev/stderr;
fastcgi_buffers 16 16k; fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k; fastcgi_buffer_size 32k;

View File

@ -8,12 +8,12 @@ set -eo pipefail
start_server() { start_server() {
log_info "Start nginx server" log_info "Start nginx server"
if ! nginx -q -g 'daemon off;' -t; then if ! nginx -e stderr -q -g 'daemon off;' -t; then
log_error 'Nginx config validation failed, exit' log_error 'Nginx config validation failed, exit'
exit 1 exit 1
fi fi
exec nginx -g "daemon off;" & exec nginx -e stderr -g "daemon off;" &
PID=$! PID=$!
{ {
@ -21,7 +21,7 @@ start_server() {
inotifywait -rq --timefmt "%F %T" --format "%T [INFO] [$(basename "$0")] %e %f" -e modify,move,create,delete /etc/nginx/ inotifywait -rq --timefmt "%F %T" --format "%T [INFO] [$(basename "$0")] %e %f" -e modify,move,create,delete /etc/nginx/
log_info 'Detected nginx config update, run validation' log_info 'Detected nginx config update, run validation'
if ! nginx -q -g 'daemon off;' -t; then if ! nginx -e stderr -q -g 'daemon off;' -t; then
log_warn 'Nginx config validation failed, skip reload' log_warn 'Nginx config validation failed, skip reload'
continue continue
fi fi