default.conf 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. upstream app{
  2. server app:8988;
  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 *.enfrancais.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_pass http://app;
  18. proxy_redirect off;
  19. }
  20. # https://serversforhackers.com/c/nginx-php-in-subdirectory
  21. location @api {
  22. rewrite ^/api/(.*)$ /api/index.php;
  23. }
  24. location /api {
  25. # rewrite /api/(.*)$ /$1 break;
  26. # root /var/www/html/api/src/web;
  27. alias /var/www/html/api/src/web/;
  28. # index index.php;
  29. # try_files $uri $uri/ /index.php?$query_string;
  30. try_files $uri $uri/ @api;
  31. error_log /var/log/nginx/api-error.log debug;
  32. location ~ \.php$ {
  33. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  34. fastcgi_pass api:9000;
  35. fastcgi_index index.php;
  36. include fastcgi_params;
  37. fastcgi_param SCRIPT_FILENAME $request_filename;
  38. fastcgi_intercept_errors off;
  39. fastcgi_buffer_size 16k;
  40. fastcgi_buffers 4 16k;
  41. fastcgi_read_timeout 150;
  42. }
  43. }
  44. location = /favicon.ico { access_log off; log_not_found off; }
  45. location = /robots.txt { access_log off; log_not_found off; }
  46. access_log on;
  47. error_log /var/log/nginx/app-error.log error;
  48. sendfile off;
  49. client_max_body_size 100m;
  50. # location ~ \.php$ {
  51. # fastcgi_split_path_info ^(.+\.php)(/.+)$;
  52. # fastcgi_pass api:9000;
  53. # fastcgi_index index.php;
  54. # include fastcgi_params;
  55. # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  56. # fastcgi_intercept_errors off;
  57. # fastcgi_buffer_size 16k;
  58. # fastcgi_buffers 4 16k;
  59. # fastcgi_read_timeout 150;
  60. # }
  61. location ~ /\.ht {
  62. deny all;
  63. }
  64. }