博客列表 >Nginx域名80端口转发到其他内网服务器

Nginx域名80端口转发到其他内网服务器

鱼的熊掌
鱼的熊掌原创
2022年07月26日 15:39:541436浏览

server
{
listen 80;
server_name cc.test.com 10.155.75.71;
index index.php index.html index.htm default.php default.htm default.html;
root D:/BtSoft/stop;

  1. #server_name $host; 转发到内网71服务器
  2. location / {
  3. proxy_pass http://10.155.75.71:80/;
  4. proxy_set_header Host cc.cnzanyu.com;
  5. proxy_redirect off;
  6. proxy_set_header X-Real-IP $remote_addr;
  7. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  8. proxy_connect_timeout 60;
  9. proxy_read_timeout 600;
  10. proxy_send_timeout 600;
  11. index index.html index.php index.htm;
  12. }
  13. #START-ERROR-PAGE
  14. #error_page 403 /403.html;
  15. #error_page 404 /404.html;
  16. #error_page 502 /502.html;
  17. #END-ERROR-PAGE
  18. #HTTP_TO_HTTPS_START
  19. #HTTP_TO_HTTPS_END
  20. #LIMIT_INFO_START
  21. #LIMIT_INFO_END
  22. #SSL-INFO-START
  23. #SSL-INFO-END
  24. #反代清理缓存配置
  25. location ~ /purge(/.*) {
  26. proxy_cache_purge cache_one $1$is_args$args;
  27. }
  28. #proxy 反向代理 需关闭!!!!!
  29. #include proxy/cc.test.com/*.conf;
  30. #PHP-INFO-START
  31. include php/73.conf;
  32. #PHP-INFO-END
  33. #REWRITE-START
  34. include rewrite/cc.test.com/*.conf;
  35. #REWRITE-END
  36. #redirect 重定向
  37. include redirect/cc.test.com/*.conf;
  38. #禁止访问的文件或目录
  39. location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|README.md)
  40. {
  41. #return 404;
  42. }
  43. #一键申请SSL证书验证目录相关设置
  44. location ~ \.well-known{
  45. allow all;
  46. }
  47. access_log D:/BtSoft/wwwlogs/cc.test.com.log;
  48. error_log D:/BtSoft/wwwlogs/cc.test.com.error.log;

}

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议