0%

Apache、Tomcat整合

Apache

  1. 安装:
    yum install httpd

  2. 加入开机启动:
    systemctl enable httpd

  3. 启动:
    systemctl start httpd

隐藏Apache版本

  1. vim /etc/http/conf/httpd.conf
    在尾部加入:
    ServerTokens Prod
    ServerSignature off

配置Apache,让80端口指向Tomcat

  1. 注释掉中心主机
    vim /etc/httpd/conf/httpd.conf

#DocumentRoot “/var/www/html”

  1. 新增配置文件
    vim /etc/httpd/conf.d/virtual.conf
    <VirtualHost *:80>
    DocumentRoot /usr/apache-tomcat-8.5.31/webapps/ROOT/
    ServerName localhost
    ProxyVia Off
    ProxyRequests Off
    ProxyPreserveHost On
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/

开启服务

  1. 开启Tomcat
    systemctl start tomcat

  2. 开启Apache
    systemctl start httpd

Apache相关目录信息

  1. 日志目录
    /var/log/httpd/

  2. 默认主页testing123文件位置
    /usr/share/httpd/