docker-caravane/Docker/nginx/default.conf

85 lines
2.2 KiB
Plaintext

upstream app{
server app:3000;
}
server {
listen 80 default_server;
# root /var/www/html/api/src/web;
# root /var/www/html/app/dist;
index index.html index.php;
server_name *.caravane.fr;
charset utf-8;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Ssl on;
proxy_cache off;
proxy_buffering off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://app;
proxy_redirect off;
}
# https://serversforhackers.com/c/nginx-php-in-subdirectory
location @api {
rewrite ^/api/(.*)$ /api/index.php;
}
location /api {
# rewrite /api/(.*)$ /$1 break;
# root /var/www/html/api/src/web;
alias /var/www/html/api/src/web/;
# index index.php;
# try_files $uri $uri/ /index.php?$query_string;
try_files $uri $uri/ @api;
error_log /var/log/nginx/api-error.log debug;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass api:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_intercept_errors off;
fastcgi_buffers 16 32k;
fastcgi_buffer_size 64k;
fastcgi_busy_buffers_size 64k;
fastcgi_read_timeout 150;
}
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log on;
error_log /var/log/nginx/app-error.log error;
sendfile off;
client_max_body_size 100m;
# location ~ \.php$ {
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
# fastcgi_pass api:9000;
# fastcgi_index index.php;
# include fastcgi_params;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_intercept_errors off;
# fastcgi_buffer_size 16k;
# fastcgi_buffers 4 16k;
# fastcgi_read_timeout 150;
# }
location ~ /\.ht {
deny all;
}
}