From aff9d897c7c368e75fdd73527ec6694e1d9ad428 Mon Sep 17 00:00:00 2001 From: paspo Date: Mon, 16 Dec 2024 19:09:18 +0100 Subject: [PATCH] fix index in php mode --- rootfs/app/entrypoint.sh | 7 +++- .../nginx/default_nophp.conf} | 2 +- rootfs/app/nginx/default_php.conf | 33 +++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) rename rootfs/{etc/nginx/http.d/default.conf => app/nginx/default_nophp.conf} (95%) create mode 100644 rootfs/app/nginx/default_php.conf diff --git a/rootfs/app/entrypoint.sh b/rootfs/app/entrypoint.sh index 03e6498..3d10aed 100755 --- a/rootfs/app/entrypoint.sh +++ b/rootfs/app/entrypoint.sh @@ -21,17 +21,22 @@ find "${WEBROOT}" -type f -exec chmod 0644 {} \; case "${PHP}" in "php84") cp /app/nginx/php84.conf /etc/nginx/custom.d/ + cp /app/nginx/default_php.conf /etc/nginx/http.d/default.conf /usr/sbin/php-fpm84 -D ;; "php83") cp /app/nginx/php83.conf /etc/nginx/custom.d/ + cp /app/nginx/default_php.conf /etc/nginx/http.d/default.conf /usr/sbin/php-fpm83 -D ;; "php82") cp /app/nginx/php82.conf /etc/nginx/custom.d/ + cp /app/nginx/default_php.conf /etc/nginx/http.d/default.conf /usr/sbin/php-fpm82 -D ;; - *) ;; + *) + cp /app/nginx/default_nophp.conf /etc/nginx/http.d/default.conf + ;; esac # start ssh diff --git a/rootfs/etc/nginx/http.d/default.conf b/rootfs/app/nginx/default_nophp.conf similarity index 95% rename from rootfs/etc/nginx/http.d/default.conf rename to rootfs/app/nginx/default_nophp.conf index 95a4784..d85d482 100644 --- a/rootfs/etc/nginx/http.d/default.conf +++ b/rootfs/app/nginx/default_nophp.conf @@ -10,7 +10,7 @@ server { #access_log /var/log/nginx/host.access.log main; location / { - index index.html index.htm; + index index.html index.htm; # autoindex on; # autoindex_exact_size off; diff --git a/rootfs/app/nginx/default_php.conf b/rootfs/app/nginx/default_php.conf new file mode 100644 index 0000000..136b549 --- /dev/null +++ b/rootfs/app/nginx/default_php.conf @@ -0,0 +1,33 @@ +error_log /dev/stdout info; +access_log /dev/stdout; + +server { + listen 80 default_server; + listen [::]:80 default_server; + root /data/www; + # server_name localhost; + + #access_log /var/log/nginx/host.access.log main; + + location / { + index index.php index.html index.htm; + + # autoindex on; + # autoindex_exact_size off; + # autoindex_format html; + # autoindex_localtime on; + } + + gzip on; + gzip_proxied any; + gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js image/x-icon font/woff2 font/woff application/x-font-woff; + gzip_vary on; + gzip_disable "msie6"; + + etag on; + if_modified_since exact; + add_header Pragma "public"; + add_header Cache-Control "max-age=31536000, public"; + + include /etc/nginx/custom.d/*.conf; +}