From 796648ac04d2f465bdc1412da79ed64c2bb5c9b2 Mon Sep 17 00:00:00 2001 From: hajimi Date: Sun, 2 Aug 2026 11:20:33 +0800 Subject: [PATCH] build: add production php and api runtime --- .../nginx/conf.d/sport-era.prod-api.conf | 50 +++++++++++++++++++ docker/config/php/conf.d/zz-opcache.prod.ini | 8 +++ docker/config/php/php-fpm.prod.conf | 3 ++ 3 files changed, 61 insertions(+) create mode 100644 docker/config/nginx/conf.d/sport-era.prod-api.conf create mode 100644 docker/config/php/conf.d/zz-opcache.prod.ini create mode 100644 docker/config/php/php-fpm.prod.conf diff --git a/docker/config/nginx/conf.d/sport-era.prod-api.conf b/docker/config/nginx/conf.d/sport-era.prod-api.conf new file mode 100644 index 0000000..e7cc07b --- /dev/null +++ b/docker/config/nginx/conf.d/sport-era.prod-api.conf @@ -0,0 +1,50 @@ +server { + listen 127.0.0.1:8000; + server_name api.sbnews.net; + + root /likeadmin_php/server/public; + index index.php index.html; + client_max_body_size 20M; + + access_log /logs/sport-era-prod_access.log; + error_log /logs/sport-era-prod_error.log; + + set_real_ip_from 127.0.0.1; + real_ip_header X-Forwarded-For; + real_ip_recursive on; + + location = /healthz { + access_log off; + default_type text/plain; + return 200 "ok\n"; + } + + location / { + try_files $uri $uri/ /index.php?s=$uri&$args; + } + + location ~ \.php$ { + try_files $uri =404; + include fastcgi_params; + fastcgi_pass 127.0.0.1:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param HTTP_X_FORWARDED_PROTO $http_x_forwarded_proto; + fastcgi_read_timeout 300s; + } + + location ~* \.(?:css|js|jpg|jpeg|gif|png|svg|ico|webp|woff2?)$ { + expires 7d; + add_header Cache-Control "public"; + try_files $uri =404; + } + + location ~ /\. { + deny all; + } + + location = /favicon.ico { + log_not_found off; + access_log off; + } +} diff --git a/docker/config/php/conf.d/zz-opcache.prod.ini b/docker/config/php/conf.d/zz-opcache.prod.ini new file mode 100644 index 0000000..80e2bdc --- /dev/null +++ b/docker/config/php/conf.d/zz-opcache.prod.ini @@ -0,0 +1,8 @@ +opcache.enable=1 +opcache.enable_cli=1 +opcache.memory_consumption=256 +opcache.interned_strings_buffer=32 +opcache.max_accelerated_files=30000 +opcache.validate_timestamps=1 +opcache.revalidate_freq=2 +opcache.save_comments=1 diff --git a/docker/config/php/php-fpm.prod.conf b/docker/config/php/php-fpm.prod.conf new file mode 100644 index 0000000..f35928d --- /dev/null +++ b/docker/config/php/php-fpm.prod.conf @@ -0,0 +1,3 @@ +[www] +listen = 127.0.0.1:9000 +listen.allowed_clients = 127.0.0.1