Fine tuning and cleanup nginx image.

This commit is contained in:
Jan Eitzinger 2021-09-14 12:06:13 +02:00
parent 13488100c4
commit e612f6c3ce
4 changed files with 39 additions and 36 deletions

1
.env
View File

@ -4,6 +4,7 @@
CLUSTERCOCKPIT_BRANCH=develop
APP_CLUSTERCOCKPIT_INIT=true
APP_ENVIRONMENT=dev
APP_SECRET=67d829bf61dc5f87a73fd814e2c9f629
########################################################################
# PHP

View File

@ -1,24 +1,8 @@
FROM nginx:1.19.6
LABEL maintainer="Vincent Composieux <vincent.composieux@gmail.com>"
FROM nginx:mainline-alpine
RUN mkdir -p /etc/nginx/templates
COPY nginx.conf /etc/nginx/
COPY templates/* /etc/nginx/templates/
ARG APP_ENVIRONMENT
ARG NGINX_SYMFONY_SERVER_NAME
ENV APP_ENV=${APP_ENVIRONMENT}
ENV APP_SECRET=67d829bf61dc5f87a73fd814e2c9f629
ENV APP_DEBUG=1
ARG INFLUXDB_PASSWORD
ARG MYSQL_PASSWORD
ENV INFLUXDB_URL=influxdb://symfony:${INFLUXDB_PASSWORD}@cc-influxdb:8086/ClusterCockpit
ENV DATABASE_URL=mysql://symfony:${MYSQL_PASSWORD}@db:3306/ClusterCockpit
ENV CORS_ALLOW_ORIGIN=^https?://(localhost|127\\.0\\.0\\.1)(:[0-9]+)?$
COPY nginx.conf /etc/nginx/
CMD ["nginx"]
EXPOSE 80
EXPOSE 443

View File

@ -1,6 +1,6 @@
user www-data;
user nginx;
worker_processes 4;
pid /run/nginx.pid;
pid /var/run/nginx.pid;
events {
worker_connections 2048;
@ -9,23 +9,40 @@ events {
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
client_body_buffer_size 256k;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 2 1k;
client_body_temp_path /tmp 1 2;
client_body_in_file_only off;
keepalive_timeout 90;
send_timeout 120;
reset_timedout_connection on;
open_file_cache max=2000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 15;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log off;
error_log off;
gzip on;
gzip_disable "msie6";
gzip_disable "MSIE [1-6]\.";
gzip_comp_level 9;
gzip_min_length 200;
include /etc/nginx/conf.d/*.conf;
open_file_cache max=100;
client_body_temp_path /tmp 1 2;
client_body_buffer_size 256k;
client_body_in_file_only off;
}
daemon off;

View File

@ -1,22 +1,23 @@
server {
server_name ${NGINX_SYMFONY_SERVER_NAME};
server_name localhost;
root /var/www/symfony/public;
location / {
try_files $uri @rewriteapp;
}
location @rewriteapp {
rewrite ^(.*)$ /index.php/$1 last;
try_files $uri /index.php$is_args$args;
}
location ~ ^/index\.php(/|$) {
fastcgi_pass php-upstream;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
fastcgi_read_timeout 300;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
}
location ~ \.php$ {
return 404;
}
}