59 lines
2.1 KiB
Plaintext
59 lines
2.1 KiB
Plaintext
# Apache 虚拟主机配置文件
|
|
# 请将此配置添加到您的 Apache 配置中
|
|
|
|
<VirtualHost *:80>
|
|
ServerName jiao77.cn
|
|
ServerAlias www.jiao77.cn
|
|
DocumentRoot /var/www/html
|
|
|
|
# 启用压缩以提高性能
|
|
<IfModule mod_deflate.c>
|
|
AddOutputFilterByType DEFLATE text/plain
|
|
AddOutputFilterByType DEFLATE text/html
|
|
AddOutputFilterByType DEFLATE text/xml
|
|
AddOutputFilterByType DEFLATE text/css
|
|
AddOutputFilterByType DEFLATE application/xml
|
|
AddOutputFilterByType DEFLATE application/xhtml+xml
|
|
AddOutputFilterByType DEFLATE application/rss+xml
|
|
AddOutputFilterByType DEFLATE application/javascript
|
|
AddOutputFilterByType DEFLATE application/x-javascript
|
|
</IfModule>
|
|
|
|
# 设置缓存头以提高性能
|
|
<IfModule mod_expires.c>
|
|
ExpiresActive On
|
|
ExpiresByType text/css "access plus 1 month"
|
|
ExpiresByType application/javascript "access plus 1 month"
|
|
ExpiresByType image/png "access plus 1 year"
|
|
ExpiresByType image/jpg "access plus 1 year"
|
|
ExpiresByType image/jpeg "access plus 1 year"
|
|
ExpiresByType image/gif "access plus 1 year"
|
|
ExpiresByType image/svg+xml "access plus 1 year"
|
|
ExpiresByType font/woff "access plus 1 year"
|
|
ExpiresByType font/woff2 "access plus 1 year"
|
|
</IfModule>
|
|
|
|
# 安全头设置
|
|
<IfModule mod_headers.c>
|
|
Header always set X-Frame-Options "SAMEORIGIN"
|
|
Header always set X-Content-Type-Options "nosniff"
|
|
Header always set Referrer-Policy "strict-origin-when-cross-origin"
|
|
</IfModule>
|
|
|
|
# 错误和访问日志
|
|
ErrorLog ${APACHE_LOG_DIR}/jiao77_error.log
|
|
CustomLog ${APACHE_LOG_DIR}/jiao77_access.log combined
|
|
</VirtualHost>
|
|
|
|
# HTTPS 配置 (如果您有 SSL 证书)
|
|
# <VirtualHost *:443>
|
|
# ServerName jiao77.cn
|
|
# ServerAlias www.jiao77.cn
|
|
# DocumentRoot /var/www/html
|
|
#
|
|
# SSLEngine on
|
|
# SSLCertificateFile /path/to/your/certificate.crt
|
|
# SSLCertificateKeyFile /path/to/your/private.key
|
|
#
|
|
# # 包括上面相同的配置...
|
|
# </VirtualHost> |