tomcat-conf-server.xml server.xml 修改该文件,并添加网页压缩功能。 <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" /> 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=""/> 修改 Apache 配置文件 修改/etc/httpd/conf/httpd.conf 配置文件 Listen 80---监听80端口 ----在 apache 服务设置中打开压缩功能,WordPress 使用该功能---- <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地址 <Directory "/var/www"> AllowOverride None # Allow open access: Require all granted----允许访问 </Directory> <IfModule dir_module> DirectoryIndex index.html index.php---添加 PHP 文件类型 </IfModule> AddType application/x-compress .Z AddType application/x-gzip .gz .tgz-------更多压缩格式 <VirtualHost 127.0.0.1:80>------服务器的IP地址 ServerName example.com ServerAlias www.example.com----Tomcat的Java平台网站域名 ProxyPass /images ! ProxyPass /css ! ProxyPass /js ! ProxyPass / http://example.com:8081/ ProxyPassReverse / http://example.com:8081/-----Tomcat启动端口 SetEnv force-proxy-request-1.0.1 SetEnv proxy-nokeepalive 1 </VirtualHost> <VirtualHost 127.0.0.1:80>------服务器的IP地址 DocumentRoot /var/www/html/ownDirectory-----您的 PHP WordPress 网站的主目录 ServerName wordpressWebsite.com ServerAlias www.wordpressWebsite.com -----PHP wordpress网站域名 DirectoryIndex index.php index.html <Directory /var/www/html/ownDirectory>-----您的 PHP WordPress 网站的主目录 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> 这样就可以在一台服务器上部署一个WordPress网站和一个Java平台网站,使用Apache服务代理Wordpress,反向代理Tomcat,完成双平台网站部署。 文章导航 Flash was disabled by various manufacturers, and SWFupload was modified to be compatible with H5 file upload. The php wordpress and java platform website under tomcat share apache, single server, dual domain name configuration.