Advertisement
dekdek04

nginx conf

Aug 2nd, 2021
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. server {
  2.  
  3. root /var/www/api.e-sabong.asia/html;
  4. index index.html index.htm index.nginx-debian.html;
  5.  
  6. server_name api.e-sabong.asia;
  7.  
  8. location / {
  9. if ($request_method = 'OPTIONS') {
  10. add_header 'Access-Control-Allow-Origin' '*';
  11. #
  12. # Om nom nom cookies
  13. #
  14. add_header 'Access-Control-Allow-Credentials' 'true';
  15. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  16. #
  17. # Custom headers and headers various browsers *should* be OK with but aren't
  18. #
  19. add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
  20. #
  21. # Tell client that this pre-flight info is valid for 20 days
  22. #
  23. add_header 'Access-Control-Max-Age' 1728000;
  24. add_header 'Content-Type' 'text/plain charset=UTF-8';
  25. add_header 'Content-Length' 0;
  26. return 204;
  27. }
  28. if ($request_method = 'POST') {
  29. add_header 'Access-Control-Allow-Origin' '*';
  30. add_header 'Access-Control-Allow-Credentials' 'true';
  31. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  32. add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
  33. }
  34. if ($request_method = 'GET') {
  35. add_header 'Access-Control-Allow-Origin' '*';
  36. add_header 'Access-Control-Allow-Credentials' 'true';
  37. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  38. add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
  39. }
  40. }
  41.  
  42. listen [::]:443 ssl ipv6only=on; # managed by Certbot
  43. listen 443 ssl; # managed by Certbot
  44. ssl_certificate /etc/letsencrypt/live/api.e-sabong.asia/fullchain.pem; # managed by Certbot
  45. ssl_certificate_key /etc/letsencrypt/live/api.e-sabong.asia/privkey.pem; # managed by Certbot
  46. include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
  47. ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
  48.  
  49. }
  50. server {
  51. if ($host = api.e-sabong.asia) {
  52. return 301 https://$host$request_uri;
  53. } # managed by Certbot
  54.  
  55.  
  56. listen 80;
  57. listen [::]:80;
  58.  
  59. server_name api.e-sabong.asia;
  60. return 404; # managed by Certbot
  61.  
  62.  
  63. }
  64.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement