diff --git a/app/.ash_history b/app/.ash_history new file mode 100644 index 0000000000000000000000000000000000000000..b5c9de2198510382a4c20e8240e6a44fe6e5610c --- /dev/null +++ b/app/.ash_history @@ -0,0 +1,2 @@ +ls +php artisan version diff --git a/app/config/nginx-default-dev.conf b/app/config/nginx-default-dev.conf index 0424e725ec0a6ef5844cad5dd64bd58e149d3bee..6bc5e85999e910125e2ec014cda2d18f4022c6d2 100644 --- a/app/config/nginx-default-dev.conf +++ b/app/config/nginx-default-dev.conf @@ -27,7 +27,7 @@ server { # error_page 500 502 503 504 /50x.html; location = /50x.html { - root /usr/share/nginx/html; + root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 diff --git a/build/fpm/Dockerfile b/build/fpm/Dockerfile index 55265dd2f74623d652ce041eb39d4961d0a56c3c..6fcafa18d30818e481af86458c8606cfb4c9dfad 100644 --- a/build/fpm/Dockerfile +++ b/build/fpm/Dockerfile @@ -1,13 +1,13 @@ -FROM alpine:3.11.3 as base +FROM alpine:3.18.4 as base RUN apk add --update \ tzdata \ ca-certificates \ zip \ redis \ - php7 \ - php7-fpm \ - php7-xdebug \ + php81 \ + php81-fpm \ + php81-xdebug \ && rm -rf /var/cache/apk/* RUN cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime @@ -23,14 +23,14 @@ FROM base as development USER root # Add common configurations development & production -ADD configuration/common/*.ini /etc/php7/conf.d/ -ADD configuration/common/*.conf /etc/php7/php-fpm.d/ +ADD ./build/fpm/configuration/common/*.ini /etc/php81/conf.d/ +ADD ./build/fpm/configuration/common/*.conf /etc/php81/php-fpm.d/ # Add development only configuration -ADD configuration/development/*.ini /etc/php7/conf.d/ -ADD configuration/development/*.conf /etc/php7/php-fpm.d/ +ADD ./build/fpm/configuration/development/*.ini /etc/php81/conf.d/ +ADD ./build/fpm/configuration/development/*.conf /etc/php81/php-fpm.d/ -CMD php-fpm7 --nodaemonize +CMD php-fpm81 --nodaemonize USER mgmaps @@ -38,7 +38,9 @@ FROM development as production USER root -RUN apk delete php7-xdebug -RUN rm /etc/php7/conf.d/xdebug.ini +RUN apk del php81-xdebug +RUN rm /etc/php81/conf.d/xdebug.ini -USER mgmaps \ No newline at end of file +USER mgmaps + +ADD ./app /html \ No newline at end of file diff --git a/build/fpm/configuration/common/fpm.conf b/build/fpm/configuration/common/fpm.conf index 8c14ae1fa0273f45cea0c76b7cc1846efe5b007d..6ad555a50c439d6eaa3def10903cfff29f53958c 100644 --- a/build/fpm/configuration/common/fpm.conf +++ b/build/fpm/configuration/common/fpm.conf @@ -1,3 +1,3 @@ [global] -error_log = syslog \ No newline at end of file +error_log = /dev/stderr \ No newline at end of file diff --git a/build/fpm/configuration/common/www.conf b/build/fpm/configuration/common/www.conf index d53f1c3234f36823ad228c4069a9c70f8c41f2ca..033b93acbb5543a241a66bc6c59f9f6bd83be32c 100644 --- a/build/fpm/configuration/common/www.conf +++ b/build/fpm/configuration/common/www.conf @@ -384,7 +384,7 @@ catch_workers_output = yes ; log level and time. This options is used only if catch_workers_output is yes. ; Settings to "no" will output data as written to the stdout or stderr. ; Default value: yes -decorate_workers_output = yes +decorate_workers_output = no ; Clear environment in FPM workers ; Prevents arbitrary environment variables from reaching FPM worker processes diff --git a/build/fpm/configuration/development/php.ini b/build/fpm/configuration/development/php.ini index 593241f029c267be96e16e4c6043562a208e52cc..ec0351f47ab828fc285b605c8af3de7838a7fa40 100644 --- a/build/fpm/configuration/development/php.ini +++ b/build/fpm/configuration/development/php.ini @@ -1,4 +1,4 @@ expose_php = On max_execution_time = 0 -display_errors = stderr +display_errors = On display_startup_errors = On \ No newline at end of file diff --git a/build/fpm/configuration/production/php.ini b/build/fpm/configuration/production/php.ini index 31c50e91e85fe04707be011410203ccf03424fc7..152de4afc765b0cd475b40aa7411ac00a0852c25 100644 --- a/build/fpm/configuration/production/php.ini +++ b/build/fpm/configuration/production/php.ini @@ -1,4 +1,4 @@ expose_php = Off max_execution_time = 30 -display_errors = Off +display_errors = stderr display_startup_errors = Off \ No newline at end of file diff --git a/build/nginx/Dockerfile b/build/nginx/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..58c96d81b9b0bc6b628defeeb17c09db236c3dcf --- /dev/null +++ b/build/nginx/Dockerfile @@ -0,0 +1,20 @@ +FROM nginx:1.25.3 as development + +RUN cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime + +ADD ./build/nginx/config/nginx.conf /etc/nginx/nginx.conf +RUN rm /etc/nginx/conf.d/default.conf +ADD ./build/nginx/config/maps.conf /etc/nginx/conf.d/maps.conf + +# Fix directories the root image is using +RUN mkdir -p /var/cache/nginx/client_temp && \ + chown -R nginx:nginx /var/cache/nginx + +USER nginx +WORKDIR /html + +CMD ["nginx"] + +FROM development as production + +ADD ./app /html \ No newline at end of file diff --git a/build/nginx/config/maps.conf b/build/nginx/config/maps.conf new file mode 100644 index 0000000000000000000000000000000000000000..f5a0878dee604eafd7da0d5e993435165ed35057 --- /dev/null +++ b/build/nginx/config/maps.conf @@ -0,0 +1,55 @@ +server { + listen 80; + server_name localhost; + root /html/public; + index index.php index.html index.htm; + + #access_log /var/log/nginx/host.access.log main; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location ~ \.php$ { + try_files $uri /index.php =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass fpm:9000; + fastcgi_index index.php; + fastcgi_read_timeout 900; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 + # + #location ~ \.php$ { + # proxy_pass http://127.0.0.1; + #} + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + #location ~ \.php$ { + # root html; + # fastcgi_pass 127.0.0.1:9000; + # fastcgi_index index.php; + # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; + # include fastcgi_params; + #} + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} +} + diff --git a/app/config/nginx.conf b/build/nginx/config/nginx.conf similarity index 73% rename from app/config/nginx.conf rename to build/nginx/config/nginx.conf index 96b512b5d167229b8eeb3fd3fc35865e455ef503..8e9c1332a484f8d3cf4c6df9b221e95f3200b353 100644 --- a/app/config/nginx.conf +++ b/build/nginx/config/nginx.conf @@ -1,11 +1,9 @@ +worker_processes auto; +daemon off; -user nginx; -worker_processes 100; - -error_log /var/log/nginx/error.log warn; -pid /var/run/nginx.pid; +error_log /dev/stderr notice; +pid /tmp/nginx.pid; -daemon off; events { worker_connections 1024; @@ -20,14 +18,14 @@ http { '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; - access_log /var/log/nginx/access.log main; + access_log /dev/stdout main; sendfile on; #tcp_nopush on; keepalive_timeout 65; - gzip on; + #gzip on; include /etc/nginx/conf.d/*.conf; } \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 1e68e67e540b9e23ce42e54b003e263c82a0e18d..e2bf7ec15814b971b6c640c95afc664ba8887d0e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,22 @@ version: "3" services: + nginx: + restart: unless-stopped + build: + dockerfile: ./build/nginx/Dockerfile + target: development + image: metagermaps:nginx-latest + ports: + - 8080:80 + working_dir: /html + volumes: + - ./app:/html fpm: restart: unless-stopped build: - context: ./build/fpm + dockerfile: ./build/fpm/Dockerfile target: development - image: metagermaps:latest + image: metagermaps:fpmlatest working_dir: /html volumes: - ./app:/html