tomcat-conf-server.xml

server.xml, Modify this file and add web page compression function.

 <Connector port="8081" protocol="HTTP/1.1"
                compression="on"
                compressionMinSize="2048"
                noCompressionUserAgents="gozilla, traviata"                  compressableMimeType="text/html,text/xml,text/css,text/javascript,image/gif,image/jpg"
                connectionTimeout="20000"
                redirectPort="8443" />

Domain name related settings in server.xml

  <Host name="example.com"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

  <Alias>www.example.com</Alias>
        <Context path="" docBase="example" debug=""/>

Modify the Apache configuration file

Modify the /etc/httpd/conf/httpd.conf configuration file

Listen 80---Listen on port 80

----Turn on compression in the apache service settings, which WordPress uses----
<IfModule mod_deflate.c>
# 圧縮レベル 9
DeflateCompressionLevel 9
# 圧縮タイプ html、xml、php、css、js
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-javascript application/x-httpd-php
AddOutputFilter DEFLATE js css
</IfModule>

ServerName 0.0.0.0:80----IP address of the server

<Directory "/var/www">
    AllowOverride None
    # Allow open access:
    Require all granted----directory allow access
</Directory>

<IfModule dir_module>
    DirectoryIndex index.html index.php---Add PHP file type
</IfModule>

 AddType application/x-compress .Z
 AddType application/x-gzip .gz .tgz-------More compressed formats


<VirtualHost 127.0.0.1:80>------IP address of the server
    ServerName example.com
    ServerAlias www.example.com----Tomcat's Java platform website domain name
    ProxyPass /images !
    ProxyPass /css !
    ProxyPass /js !
    ProxyPass / http://example.com:8081/
    ProxyPassReverse / http://example.com:8081/-----Tomcat startup port
    SetEnv force-proxy-request-1.0.1
    SetEnv proxy-nokeepalive 1
</VirtualHost>


<VirtualHost 127.0.0.1:80>------IP address of the server
    DocumentRoot /var/www/html/ownDirectory-----The main directory of your PHP WordPress site
    ServerName wordpressWebsite.com  
    ServerAlias www.wordpressWebsite.com -----PHP wordpress website domain name
    DirectoryIndex index.php index.html
        <Directory /var/www/html/ownDirectory>-----The main directory of your PHP WordPress siteトリ
                options -indexes
                AllowOverride All
        </Directory>
    RewriteRule .(svn|git)(/)?$ - [F]
    <IfModule mod_headers.c>
        Header set X-XSS-Protection "1; mode=block"
        Header always append X-Frame-Options SAMEORIGIN
    </IfModule>
    SetEnv force-proxy-request-1.0.1
    SetEnv proxy-nokeepalive 1
</VirtualHost>

In this way, a WordPress website and a Java platform website can be deployed on one server, and the Apache service is used to proxy WordPress and reverse proxy Tomcat to complete the dual-platform website deployment.

发表回复

Thanks for your support to bet365fans!