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 /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 && \
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
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;
|
||||||
@ -15,7 +16,6 @@ http {
|
|||||||
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;
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user