今天使用upupw apache服务,怎么设置https。
找了好久,也查了一下资料,终于可以搞定了。
<VirtualHost *:80 *:443>
DocumentRoot "网站存放路径"
ServerName 17sohu.com
ServerAlias 17sohu.com www.17sohu.com
ServerAdmin webmaster@17sohu.com
DirectoryIndex index.html index.php
ErrorLog logs/17sohu.com-error.log
CustomLog logs/17sohu.com-access_%Y%m%d.log comonvhost
php_admin_value open_basedir "D:wwwooochsohu@com"
SSLEngine on
SSLEngine on
SSLCertificateFile "存放路径/www.17sohu.com.crt"
SSLCertificateKeyFile "存放路径/www.17sohu.com.key"
SSLCertificateChainFile "存放路径/root_bundle.crt"
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R=301,L]
<Directory "网站存放路径">
Options FollowSymLinks
SSLOptions +StdEnvVars
AllowOverride All
Require all granted
</Directory>
<LocationMatch "/(attachment|attachments|uploadfiles)/(.*).(php|php5|php7|phps|asp|asp.net|jsp)$">
Require all denied
</LocationMatch>
</VirtualHost>
参考如上设置!