Advertisement
Guest User

Untitled

a guest
Aug 30th, 2021
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. server {
  2. listen 80;
  3. server_name localhost;
  4.  
  5. index index.php index.html;
  6. root /app/public;
  7.  
  8.  
  9. location / {
  10. try_files $uri /index.php$is_args$args;
  11. # https://stackoverflow.com/questions/31493634/laravel-routes-not-found-on-nginx
  12. #try_files $uri $uri/ /index.php?$query_string;
  13. # Simple requests
  14. if ($request_method ~* "(GET|POST)") {
  15. add_header "Access-Control-Allow-Origin" * always;
  16. }
  17. # Preflighted requests
  18. if ($request_method = OPTIONS ) {
  19. #add_header "Access-Control-Allow-Origin" * always;
  20. add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, HEAD";
  21. add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept";
  22. return 200;
  23. }
  24. }
  25. location ~ ^/index\.php(/|$) {
  26. try_files $uri =404;
  27.  
  28. # https://stackoverflow.com/questions/31493634/laravel-routes-not-found-on-nginx
  29. #try_files $uri $uri/ /index.php?$query_string;
  30.  
  31. fastcgi_split_path_info ^(.+\.php)(/.*)$;
  32. fastcgi_pass laravel_vue_companies_php:9000;
  33. fastcgi_index index.php;
  34. include fastcgi_params;
  35. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  36. fastcgi_param PATH_INFO $fastcgi_path_info;
  37.  
  38. # Simple requests
  39. if ($request_method ~* "(GET|POST)") {
  40. #add_header "Access-Control-Allow-Origin" * always;
  41. }
  42.  
  43. # Preflighted requests
  44. if ($request_method = OPTIONS ) {
  45. #add_header "Access-Control-Allow-Origin" * always;
  46. add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, HEAD";
  47. add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept";
  48. return 200;
  49. }
  50. }
  51.  
  52. location ~ \.php$ {
  53. return 404;
  54. }
  55.  
  56. error_log /var/log/nginx/error.log;
  57. access_log /var/log/nginx/access.log;
  58. }
  59.  
  60.  
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement