tomcat-conf-server.xml
server.xml Sửa đổi tệp này và thêm chức năng nén trang web.
<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" />
Cài đặt liên quan đến tên miền trong 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=""/>
Sửa đổi tập tin cấu hình Apache
Sửa đổi tệp cấu hình /etc/httpd/conf/httpd.conf
Nghe 80---Nghe cổng 80
----Bật tính năng nén trong cài đặt dịch vụ apache, WordPress sử dụng tính năng này----
<IfModule mod_deflate.c>
# Mức nén 9
DeflateCompressionLevel 9
# Kiểu nén 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----Địa chỉ IP của máy chủ
<Directory "/var/www">
AllowOverride None
# Allow open access:
Require all granted----Cho phép truy cập
</Directory>
<IfModule dir_module>
DirectoryIndex index.html index.php---Thêm loại tệp PHP
</IfModule>
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz-------Nhiều định dạng nén hơn
<VirtualHost 127.0.0.1:80>------Địa chỉ IP máy chủ
ServerName example.com
ServerAlias www.example.com----Tên miền trang web nền tảng Java Tomcat
ProxyPass /images !
ProxyPass /css !
ProxyPass /js !
ProxyPass / http://example.com:8081/
ProxyPassReverse / http://example.com:8081/-----Cổng khởi động Tomcat
SetEnv force-proxy-request-1.0.1
SetEnv proxy-nokeepalive 1
</VirtualHost>
<VirtualHost 127.0.0.1:80>------Địa chỉ IP máy chủ
DocumentRoot /var/www/html/ownDirectory-----Thư mục chính của trang web PHP WordPress của bạn
ServerName wordpressWebsite.com
ServerAlias www.wordpressWebsite.com -----Tên miền trang web PHP wordpress
DirectoryIndex index.php index.html
<Directory /var/www/html/ownDirectory>-----Thư mục chính của trang web PHP WordPress của bạn
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>