update nginx

This commit is contained in:
Tim Bendt
2025-11-28 23:07:40 -05:00
parent d9ea9532eb
commit f1b15699d0

View File

@@ -1,17 +1,51 @@
upstream php { # upstream php {
server unix:/var/run/php/php8.3-fpm.sock; # server unix:/var/run/php/php8.3-fpm.sock;
# }
worker_processes 5;
daemon off;
worker_rlimit_nofile 8192;
events {
worker_connections 4096; # Default: 1024
} }
server { http {
listen 8080; include $!{nginx}/conf/mime.types;
root /var/www/html; index index.html index.htm index.php;
index index.php index.html;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /dev/stdout;
error_log /dev/stdout;
sendfile on;
tcp_nopush on;
server_names_hash_bucket_size 128; # this seems to be required for some vhosts
server {
listen ${PORT};
listen [::]:${PORT};
server_name localhost;
$if(NIXPACKS_PHP_ROOT_DIR) (
root ${NIXPACKS_PHP_ROOT_DIR};
) else (
root /app;
)
# Block access to hidden files and directories # Block access to hidden files and directories
location ~ /\. { location ~ /\. {
deny all; deny all;
} }
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
# Static files for root directory # Static files for root directory
location / { location / {
try_files $uri $uri/ =404; try_files $uri $uri/ =404;
@@ -66,11 +100,12 @@ server {
} }
# Handle PHP files # Handle PHP files
location ~ \.php$ { location ~ \.php$ {
include fastcgi_params; fastcgi_pass 127.0.0.1:9000;
fastcgi_pass php; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include $!{nginx}/conf/fastcgi_params;
fastcgi_param HTTPS off; include $!{nginx}/conf/fastcgi.conf;
} }
# Gzip compression # Gzip compression
@@ -125,3 +160,4 @@ server {
# Error pages # Error pages
error_page 404 /404.html; error_page 404 /404.html;
} }
}