apache 虚拟主机配置多站点
来源:互联网 发布:软件测试实验室 编辑:程序博客网 时间:2024/06/06 02:41
apache 安装之后配置文件位于/etc/httpd/conf/
vim /etc/httpd/conf/httpd.conf
Include /etc/httpd/extra/vhost.conf
编辑vhost.conf 新增站点:
<VirtualHost *:80> ServerName domain.com //自己域名 ServerAlias www.domain.com //自己域名 DocumentRoot /myData/www/web3 //站点位置 <Directory "/myData/www/web3"> Options Indexes AllowOverride All Require all granted </Directory></VirtualHost>
可以多这种方式新增多个站点。
apache 启用压缩和缓存:
vim /etc/httpd/conf/httpd.conf
新增以下配置:
#gzip
LoadModule headers_module modules/mod_headers.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule filter_module modules/mod_filter.so
#gzip
#expires cache
LoadModule expires_module modules/mod_expires.so
#expires cache
在httpd.conf最后新增以下配置内容:
#gzip
<ifmodule mod_deflate.c>
DeflateCompressionLevel 6
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom_xml
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE image/svg+xml
</ifmodule>
#gzip
#expires cache
<IfModule expires_module>
ExpiresActive on
ExpiresByType text/css A864000 //过期时间864000秒
ExpiresByType application/x-JavaScript A864000
ExpiresByType application/javascript A864000
ExpiresByType text/html A3600
ExpiresByType image/jpeg A864000
ExpiresByType image/gif A864000
ExpiresByType image/png A864000
ExpiresByType image/x-icon A864000
</IfModule>
#expires cache
安装mysql扩展
yum -y install php-mysql
支持https
1.yum install mod_ssl openssl
2.生成签名证书(可以申请免费的腾讯云证书,1年有效期)
3.修改apache配置
vim /etc/httpd/conf.d/ssl.conf
其实ssl.conf文件就是配置虚拟站点的文件
SSLCertificateFile /etc/pki/tls/certs/ca.crt
SSLCertificateKeyFile /etc/pki/tls/private/ca.key
4.修改防火墙,增加443端口(很关键,当初忘记在防火墙中增加443端口)
强制跳转https
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
- apache配置多站点,虚拟主机
- apache 虚拟主机配置多站点
- apache的多站点虚拟主机配置方法
- Apache 2.4.9多站点(虚拟主机)配置
- 基于Apache在本地配置多个虚拟主机站点
- 在Apache下配置多个虚拟主机站点
- WAMP下Apache配置httpd-vhosts虚拟主机多站点
- 基于Apache在本地配置多个虚拟主机站点 .
- Apache在本地配置多个虚拟主机站点
- 基于Apache在本地配置多个虚拟主机站点
- linux下安装iasp以及apache多站点虚拟主机配置
- linux下安装iasp以及apache多站点虚拟主机配置
- apache虚拟主机实现多站点
- 基于 Apache 在本地配置多个虚拟主机,实现本地多站点访问
- Apache之——多虚拟主机多站点配置的两种实现方案
- Apache之——多虚拟主机多站点配置的两种实现方案
- Apache之——多虚拟主机多站点配置的两种实现方案
- Apache之——多虚拟主机多站点配置的两种实现方案
- int main(int argc,char* argv[])详解
- 关于modbus rtu协议的CRC(循环冗余校验)在线计算
- 一致性算法Raft详解
- 多线程学习第一篇
- 编程基础刷题(三)
- apache 虚拟主机配置多站点
- model实体类中Hibernate注解说明
- jvm内存分配
- 01 stm32初探
- Android Studio中的project文件在电脑中的存储位置
- 集合类-Set
- 微信小程序按钮不能跳转Tab的解决方法
- Appium连接海马玩模拟器
- 循环链表