apache80端号跳转443端口

apache80端号跳转443端口调取的虚拟主机的配置文件

 

调取虚拟主机内容,80端口的顶级域名,跳转至www的443端口

<VirtualHost ip:80>      80重写443端口

ServerAdmin aaa.com       需要跳转的域名

DocumentRoot “/home/wwwroot/baoxian_program”    访问网页路径

ServerName aaa.com               网页域名

RewriteEngine On                         url重写向开启

RewriteCond %{SERVER_PORT} !^443$        指定跳转至443端口

RewriteRule ^(.*)$ https://www.%{HTTP_HOST}$1 [R,L]      跳转至https://www.域名.com/url

<Directory “/home/wwwroot/baoxian_program”>       所需访问页面存放路径

Options none

AllowOverride none

Order allow,deny

Allow from all

Require all granted

 

</Directory>

</VirtualHost>

 

 

<VirtualHost ip:443>            443端口配置

SSLEngine On                         ssl开启

SSLCertificateKeyFile /home/ssl/www.aaa.com.key    私钥文件

SSLCertificateChainFile /home/ssl/www.aaa.com_ca.crt   安全证书

SSLCertificateFile /home/ssl/www.aaa.com.cer      安全证书

DocumentRoot “/home/wwwroot/baoxian_program”     网页存放路径

ServerName www.aaa.com                 访问域名

ServerAlias www.aaa.com                    域名别名

#RewriteEngine On

#RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R,L]

<Directory “/home/wwwroot/baoxian_program”>

Options FollowSymLinks ExecCGI     选项

AllowOverride All                  指令 所有

Order allow,deny                  订单允许,拒绝

Allow from all                       允许所有

Require all granted                   需要开启

</Directory>

</VirtualHost>