• apache 反向代理配置


           配置前资料检查:

           1.可以使用的apache

           安装apache服务:打开cmd , 在apache的bin目录下执行以下命令

           httpd -k install -n apache2.2    其中"apache2.2"是服务名,视情况而定(要看你的apache版本)

           2.你的部署任务中是否给了静态文件(即:网页文件),配置中需要文件的路径

           3.网路是否通畅,另外关闭window防火墙

           

           开始配置

           进入apache的conf 文件夹内,找到http.conf文件,配置apache

           关键配置点

           1.Listen 80     监听端口 一半默认为80  

            可以在cmd输入命令 net stat -ano  检查端口是否占

          2.

             <Directory "path">
                 Options FollowSymLinks
                 AllowOverride None
                 Order allow,deny
                 Allow from all
            </Directory>

            path 为静态文件所在路径

            allow from all,默认是deny from all  要改成allow

         3.NameVirtualHost *:9999 反向代理配置   9999是端口

            <VirtualHost *:9999>
             ServerAdmin   xxxx@xx.com     网站管理员邮件地址
             ServerName    ********   站点主机名成
          
            ErrorLog "logs/DJBH-error-%Y-%m-%d.log 86400 480"  error日志目录
            CustomLog "logs/DJBH-access-%Y-%m-%d.log 86400 480" custom日志目录

            DocumentRoot "D:/xxx/web/ROOT"  静态文件(即:网页存储位置)

            DirectoryIndex xx/index.html  index.html(即:默认欢迎页或者首页) 的相对路径
           <proxy >
            Order deny,allow
            Allow from all
           </proxy>
           ErrorDocument 404 /DJBH/404.html   报错页面路径
           ErrorDocument 403 /DJBH/403.html   报错页面路径
           ErrorDocument 500 /DJBH/500.html   报错页面路径

           ProxyPass /xx ajp://172.16.20.221:8009/xx                重点在于ajp 在你的服务器(tomcat之流)的配置(server.xml文件)中查看ajp端口,记住不是http端口

           ProxyPassReverse /xx ajp://172.16.20.221:8009/xx

          ProxyPass和ProxyPassReverse   反向代理配置   即  :将该主机收到的请求 代理到172.16.20.221:8009  然后反向响应

    </VirtualHost>

      

  • 相关阅读:
    NGINX location 在配置中的优先级
    CentOS 系统启动流程
    微软输入法正则bug
    uniapp改变页面背景色
    路由Router
    vue-cli3替换默认的title和图标(区别脚手架vue-cli2版本)
    浏览器报错 Refused to apply style from 'http://******' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
    禁止浏览器后退
    前端构建工具(webpack-gulp-grunt-rollup...)
    鼠标经过小箭头(状态伪类需求)
  • 原文地址:https://www.cnblogs.com/maxm/p/5517626.html
Copyright © 2020-2023  润新知