From 37260f75ea49452bda01f95adac4536d0f1f6f23 Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Wed, 22 Mar 2023 20:12:52 +0800 Subject: [PATCH] update: using unix socket instead of local forward --- Dockerfile | 4 +++- init.sh | 1 + nginx/alltube.conf | 7 +++---- nginx/nginx.conf | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5b6634a..c32d824 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,9 @@ FROM ${ALPINE} # TODO: /usr/bin/python already exist after alpine:3.17 RUN apk add --no-cache nginx python3 php-fpm php-mbstring \ php-dom php-gmp php-xml php-intl php-json php-gettext php-simplexml php-tokenizer php-xmlwriter && \ - ln -s /usr/bin/python3 /usr/bin/python + ln -s /usr/bin/python3 /usr/bin/python && \ + sed -i '/error_log/a\error_log = /dev/stdout' /etc/php7/php-fpm.conf && \ + sed -i 's?127.0.0.1:9000?/run/php-fpm.sock?' /etc/php7/php-fpm.d/www.conf COPY --from=build /alltube/ /var/www/alltube/ COPY ./init.sh /usr/bin/alltube COPY ./nginx/ /etc/nginx/ diff --git a/init.sh b/init.sh index b200d18..5800d5b 100755 --- a/init.sh +++ b/init.sh @@ -3,5 +3,6 @@ if [ -n "$TITLE" ]; then sed -i "/^appName:/cappName: $TITLE" /var/www/alltube/config/config.yml fi + /usr/sbin/nginx exec /usr/sbin/php-fpm7 -F diff --git a/nginx/alltube.conf b/nginx/alltube.conf index 9aac555..8685dc7 100644 --- a/nginx/alltube.conf +++ b/nginx/alltube.conf @@ -1,12 +1,12 @@ server { listen 80; - root /var/www/alltube/; index index.php; + root /var/www/alltube/; types { - text/html html htm shtml; text/css css; text/xml xml; + text/html html htm shtml; application/x-web-app-manifest+json webapp; } @@ -20,14 +20,13 @@ server { location ~ \.php$ { include fastcgi_params; - fastcgi_pass 127.0.0.1:9000; + fastcgi_pass unix:/run/php-fpm.sock; try_files $uri /index.php?$args; fastcgi_buffers 4 16k; fastcgi_buffer_size 16k; fastcgi_index index.php; fastcgi_intercept_errors off; fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_param HTTPS 'ok'; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 89a8758..24d981d 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -10,7 +10,7 @@ events { http { log_format access '[$time_iso8601] $remote_addr -> $scheme://$host - "$request"' ' -> ($status) ↑$request_length ↓$bytes_sent {$http_user_agent}'; - access_log /dev/stdout access; + access_log /var/log/alltube.log access; include /etc/nginx/mime.types; include /etc/nginx/alltube.conf; }