fix: move error log to stderr globally
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3d71062d4b
commit
3ee6e3c6ff
@ -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 /etc/nginx/conf.d/vhosts.conf && \
|
||||
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 root:nginx /etc/nginx /etc/nginx/conf.d && \
|
||||
chmod -R 640 /etc/nginx /etc/nginx/conf.d && \
|
||||
|
@ -1,5 +1,6 @@
|
||||
worker_processes 1;
|
||||
pid /var/run/nginx.pid;
|
||||
error_log stderr error;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
@ -15,7 +16,6 @@ http {
|
||||
keepalive_timeout 65;
|
||||
server_tokens off;
|
||||
access_log off;
|
||||
error_log /dev/stderr;
|
||||
|
||||
fastcgi_buffers 16 16k;
|
||||
fastcgi_buffer_size 32k;
|
||||
|
@ -8,12 +8,12 @@ set -eo pipefail
|
||||
|
||||
start_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'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec nginx -g "daemon off;" &
|
||||
exec nginx -e stderr -g "daemon off;" &
|
||||
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/
|
||||
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'
|
||||
continue
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user