kubernetes #comment Reconfigure nginx to serve log on stdout

This commit is contained in:
Alexandre BRACH
2019-09-27 14:31:17 +02:00
parent b7f5a4cf3c
commit b66aae5047
2 changed files with 31 additions and 74 deletions

View File

@@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
cat nginx.conf.sample | sed "s/\$MAX_BODY_SIZE/$MAX_BODY_SIZE/g" > /etc/nginx/nginx.conf set -xe
cat nginx.conf.sample | sed "s/\$MAX_BODY_SIZE/$MAX_BODY_SIZE/g" > /etc/nginx/conf.d/default.conf
nginx -g "daemon off;" nginx -g "daemon off;"

View File

@@ -1,84 +1,39 @@
user app; upstream backend {
worker_processes auto; server phraseanet:9000;
#error_log /var/log/ngnix_error.log info;
error_log /dev/stdout info;
pid /var/run/nginx.pid;
#daemon off;
events {
worker_connections 1024;
multi_accept on;
} }
http { server {
include /etc/nginx/mime.types; listen 80;
default_type application/octet-stream; root /var/alchemy/Phraseanet/www;
server_tokens off;
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' index index.php;
'$status $body_bytes_sent "$http_referer" ' client_max_body_size $MAX_BODY_SIZE;
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /dev/stdout main; location /api {
rewrite ^(.*)$ /api.php/$1 last;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
reset_timedout_connection on;
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_read_timeout 300;
resolver 127.0.0.11;
upstream backend {
server phraseanet:9000;
} }
server { location / {
listen 80; # First attempt to serve request as file, then
error_log on; # as directory, then fall back to index.html
access_log on; try_files $uri $uri/ @rewriteapp;
root /var/alchemy/Phraseanet/www; }
index index.php; location @rewriteapp {
client_max_body_size $MAX_BODY_SIZE; rewrite ^(.*)$ /index.php/$1 last;
}
location /api { # PHP scripts -> PHP-FPM server listening on 127.0.0.1:9000
rewrite ^(.*)$ /api.php/$1 last; location ~ ^/(index|index_dev|api)\.php(/|$) {
} fastcgi_pass backend;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location / { location ~ ^/(status|ping)$ {
# First attempt to serve request as file, then fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# as directory, then fall back to index.html fastcgi_index index.php;
try_files $uri $uri/ @rewriteapp; include fastcgi_params;
} fastcgi_pass backend;
location @rewriteapp {
rewrite ^(.*)$ /index.php/$1 last;
}
# PHP scripts -> PHP-FPM server listening on 127.0.0.1:9000
location ~ ^/(index|index_dev|api)\.php(/|$) {
fastcgi_pass backend;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ ^/(status|ping)$ {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_pass backend;
}
} }
} }