diff --git a/docker/nginx/boot.sh b/docker/nginx/boot.sh index 49e6b8a3b7..2684d8c0f7 100755 --- a/docker/nginx/boot.sh +++ b/docker/nginx/boot.sh @@ -1,4 +1,6 @@ #!/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;" diff --git a/docker/nginx/nginx.conf.sample b/docker/nginx/nginx.conf.sample index 0284f137d9..ad015e7c5a 100644 --- a/docker/nginx/nginx.conf.sample +++ b/docker/nginx/nginx.conf.sample @@ -1,84 +1,39 @@ -user app; -worker_processes auto; - -#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; +upstream backend { + server phraseanet:9000; } -http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - server_tokens off; +server { + listen 80; + root /var/alchemy/Phraseanet/www; - log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" "$http_x_forwarded_for"'; + index index.php; + client_max_body_size $MAX_BODY_SIZE; - access_log /dev/stdout main; - - 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; + location /api { + rewrite ^(.*)$ /api.php/$1 last; } - server { - listen 80; - error_log on; - access_log on; - root /var/alchemy/Phraseanet/www; + location / { + # First attempt to serve request as file, then + # as directory, then fall back to index.html + try_files $uri $uri/ @rewriteapp; + } - index index.php; - client_max_body_size $MAX_BODY_SIZE; + location @rewriteapp { + rewrite ^(.*)$ /index.php/$1 last; + } - location /api { - rewrite ^(.*)$ /api.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 / { - # First attempt to serve request as file, then - # as directory, then fall back to index.html - try_files $uri $uri/ @rewriteapp; - } - - 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; - } + location ~ ^/(status|ping)$ { + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_pass backend; } }