Go框架demo
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.7 KiB

3 years ago
  1. # REPO_NAME.public.conf
  2. # REPO_NAME nginx config file.
  3. #
  4. # This file auto generated by REPO_NAME/scripts/init_config.sh,
  5. # [WARRING!] DO NOT change this manualy.
  6. #
  7. # @version 170227:1
  8. # @author zhangxuhong <zhangxuhong@xitu.io>
  9. #
  10. upstream REPO_NAME_public {
  11. server UPSTREAM_ADDR;
  12. keepalive 64;
  13. }
  14. server {
  15. listen 80;
  16. server_name DOMAIN_NAME;
  17. default_type 'text/plain'; # or browser will download page
  18. include /data/apps/nginx/conf/origin/gold.xitu.io_and_juejin.im.conf;
  19. root /data/repo/REPO_NAME;
  20. access_log /data/repo/REPO_NAME/logs/nginx-access.public.log logstash;
  21. error_log /data/repo/REPO_NAME/logs/nginx-error.public.log;
  22. client_body_temp_path /data/logs/nginx/client_body_temp/ 1 2;
  23. proxy_temp_path /data/logs/nginx/proxy_temp/ 1 2;
  24. # X-Juejin-Src for api src trace back
  25. # X-Juejin-Uid for non-login user id
  26. # X-Juejin-Token for api param hash check
  27. add_header 'Access-Control-Allow-Headers' 'X-Juejin-Src,X-Juejin-Uid,X-Juejin-Token' always;
  28. if ($request_method = OPTIONS ) {
  29. return 200;
  30. }
  31. # global location settings
  32. location /status {
  33. return 200;
  34. }
  35. location / {
  36. proxy_set_header X-Real-IP $remote_addr;
  37. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  38. proxy_set_header Host $http_host;
  39. proxy_set_header X-Nginx-Proxy true;
  40. proxy_pass http://REPO_NAME_public;
  41. }
  42. location ~ /\. {
  43. deny all;
  44. access_log off;
  45. log_not_found off;
  46. }
  47. }