Apache 虚拟主机和反向代理配置

2023-07-0209:34:44网站管理维护Comments1,267 views字数 478阅读模式

Nginx可以很方便的做反向代理,实现一些诸如服务信息隐藏、负载均衡等功能,其实Apache也是一样可以实现的,并且实现起来也不必Nginx麻烦多少。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/wg/49217.html

Apache虚拟主机的配置想必大家都很清楚了,这个不用多说,下面是基本的虚拟主机配置文件。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/wg/49217.html

#虚拟主机配置文章源自菜鸟学院-https://www.cainiaoxueyuan.com/wg/49217.html

ServerAdmin 470266798@qq.com文章源自菜鸟学院-https://www.cainiaoxueyuan.com/wg/49217.html

DocumentRoot D:/wwwroot文章源自菜鸟学院-https://www.cainiaoxueyuan.com/wg/49217.html

ServerName abc.com文章源自菜鸟学院-https://www.cainiaoxueyuan.com/wg/49217.html

ServerAlias www.abc.com文章源自菜鸟学院-https://www.cainiaoxueyuan.com/wg/49217.html

ErrorLog D:/logs/abc.com.error.log文章源自菜鸟学院-https://www.cainiaoxueyuan.com/wg/49217.html

CustomLog D:/logs/abc.com.log common 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/wg/49217.html

下面我们来看一下Apache反向代理的配置。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/wg/49217.html

#反向代理配置 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/wg/49217.html

ServerName abc.com文章源自菜鸟学院-https://www.cainiaoxueyuan.com/wg/49217.html

ServerAlias www.abc.com文章源自菜鸟学院-https://www.cainiaoxueyuan.com/wg/49217.html

ProxyRequests off文章源自菜鸟学院-https://www.cainiaoxueyuan.com/wg/49217.html

ProxyPass / http://127.0.0.1:8080/文章源自菜鸟学院-https://www.cainiaoxueyuan.com/wg/49217.html

ProxyPassReverse / http:/127.0.0.1:8080/ 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/wg/49217.html

其实很简单,只是把 DocumentRoot 换成了 ProxyPass 的真实服务器信息。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/wg/49217.html

  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/wg/49217.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定