diff --git a/nginx.template.conf b/nginx.template.conf new file mode 100644 index 0000000..e72154e --- /dev/null +++ b/nginx.template.conf @@ -0,0 +1,62 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + include $!{nginx}/conf/mime.types; + default_type application/octet-stream; + + server { + listen 80; + + root /app; + index index.php; + + location /wss { + proxy_pass http://hnschat-server:4444/; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + } + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location ~ \.php$ { + include $!{nginx}/conf/fastcgi_params; + fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # Modify the PHP-FPM socket path as per your setup + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param DOCUMENT_ROOT $document_root; + } + + location ~* ^/(avatar.php|preview.php|assets|uploads)/ { + add_header Cache-Control "max-age=63072000, public"; + } + + location ~ ^/(avatar|preview)/([A-Za-z0-9]+)/?$ { + rewrite ^/avatar/([A-Za-z0-9]+)/?$ /etc/avatar.php?id=$1 last; + rewrite ^/preview/([A-Za-z0-9]+)/?$ /etc/preview.php?id=$1 last; + } + + location ~ ^/invite/([A-Za-z0-9-]+)/?$ { + rewrite ^/invite/([A-Za-z0-9-]+)/?$ /id.php?invite=$1 last; + } + + # Enable CORS headers + add_header Access-Control-Allow-Origin "*"; + add_header Access-Control-Allow-Methods "GET"; + + # Disable server tokens and signatures + server_tokens off; + add_header X-Powered-By "PHP/7.4"; # Modify PHP version as per your setup + + # Directory permissions for /app + location /app/ { + allow all; + } + } +} diff --git a/nixpacks.json b/oldnixpacks.json similarity index 100% rename from nixpacks.json rename to oldnixpacks.json