default.conf 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. upstream app{
  2. server app:5173;
  3. }
  4. server {
  5. listen 80 default_server;
  6. # root /var/www/html/api/src/web;
  7. # root /var/www/html/app/dist;
  8. index index.html index.php;
  9. server_name *.ouatterrir.fr;
  10. charset utf-8;
  11. location / {
  12. proxy_set_header X-Real-IP $remote_addr;
  13. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  14. proxy_set_header Host $http_host;
  15. proxy_set_header X-NginX-Proxy true;
  16. proxy_set_header X-Ssl on;
  17. proxy_cache off;
  18. proxy_pass http://app;
  19. proxy_redirect off;
  20. }
  21. # https://serversforhackers.com/c/nginx-php-in-subdirectory
  22. location @api {
  23. rewrite ^/api/(.*)$ /api/index.php;
  24. }
  25. location /api {
  26. # rewrite /api/(.*)$ /$1 break;
  27. # root /var/www/html/api/src/web;
  28. alias /var/www/html/api/src/web/;
  29. # index index.php;
  30. # try_files $uri $uri/ /index.php?$query_string;
  31. try_files $uri $uri/ @api;
  32. error_log /var/log/nginx/api-error.log debug;
  33. location ~ \.php$ {
  34. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  35. fastcgi_pass api:9000;
  36. fastcgi_index index.php;
  37. include fastcgi_params;
  38. fastcgi_param SCRIPT_FILENAME $request_filename;
  39. fastcgi_intercept_errors off;
  40. fastcgi_buffer_size 16k;
  41. fastcgi_buffers 4 16k;
  42. fastcgi_read_timeout 150;
  43. }
  44. }
  45. location = /favicon.ico { access_log off; log_not_found off; }
  46. location = /robots.txt { access_log off; log_not_found off; }
  47. access_log on;
  48. error_log /var/log/nginx/app-error.log error;
  49. sendfile off;
  50. client_max_body_size 100m;
  51. # location ~ \.php$ {
  52. # fastcgi_split_path_info ^(.+\.php)(/.+)$;
  53. # fastcgi_pass api:9000;
  54. # fastcgi_index index.php;
  55. # include fastcgi_params;
  56. # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  57. # fastcgi_intercept_errors off;
  58. # fastcgi_buffer_size 16k;
  59. # fastcgi_buffers 4 16k;
  60. # fastcgi_read_timeout 150;
  61. # }
  62. location ~ /\.ht {
  63. deny all;
  64. }
  65. }