1. upstream goodcorn_api {
  2. server 10.1.118.76:10088 max_fails=5 fail_timeout=10; #这个ip一定不要用127.0.0.1,毕竟我的go代码不跑在容器里
  3. keepalive 20000;
  4. }
  5. upstream web {
  6. server 10.1.118.76:8000 max_fails=5 fail_timeout=10; #这个ip一定不要用127.0.0.1,毕竟我的go代码不跑在容器里
  7. keepalive 20000;
  8. }
  9. server {
  10. listen 80;
  11. #listen [::]:80 default_server ipv6only=on;
  12. # For https
  13. # listen 443 ssl default_server;
  14. # listen [::]:443 ssl default_server ipv6only=on;
  15. # ssl_certificate /etc/nginx/ssl/default.crt;
  16. # ssl_certificate_key /etc/nginx/ssl/default.key;
  17. server_name goodcorn.com;
  18. root /var/www/src/github.com/goodcorn/web/dist;
  19. index index.php index.html index.htm;
  20. location /api {
  21. proxy_pass http://goodcorn_api;
  22. }
  23. location / {
  24. proxy_pass http://web;
  25. }
  26. #location / {
  27. # try_files $uri $uri/ /index.html; #npm run build以后,就用这个。
  28. #}
  29. location ~ /\.ht {
  30. deny all;
  31. }
  32. }