Advertisement
Guest User

Untitled

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