apache https访问配置

1.httpd-ssh.conf

Listen 443

SSLStrictSNIVHostCheck off

SSLCipherSuite AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL

SSLProtocol all -SSLv2 -SSLv3

<VirtualHost *:443>

ServerAdmin joey

DocumentRoot "E:/www/API/public"

ServerName localhost:443

ErrorLog "logs/errlog"

CustomLog "logs/accesslog" common

SSLEngine on

SSLCipherSuite RC4-SHA:AES128-SHA:HIGH:MEDIUM:!aNULL:!MD5

SSLCertificateFile "E:/Web/phpStudy/PHPTutorial/Apache/conf/ssl/server.crt"

SSLCertificateKeyFile "E:/Web/phpStudy/PHPTutorial/Apache/conf/ssl/server.key"

<Directory "E:/www/API/public">

Order allow,deny

Allow from all

</Directory>

</VirtualHost>

2..haccess

<IfModule mod_rewrite.c>

Options +FollowSymlinks -Multiviews

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]

RewriteBase /

RewriteCond %{SERVER_PORT} !^443$

RewriteRule ^.* https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

</IfModule>

3.httpd.conf

LoadModule ssl_module modules/mod_ssl.so

Include conf/extra/httpd-ssl.conf

对于非80端口,配置如下:

.haccess

<IfModule mod_rewrite.c>

Options +FollowSymlinks -Multiviews

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]

RewriteBase /

RewriteCond %{SERVER_PORT} !^1589$

RewriteRule ^.* https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

</IfModule>

httpd-ssh.conf

Listen 443

SSLStrictSNIVHostCheck off

SSLCipherSuite AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL

SSLProtocol all -SSLv2 -SSLv3

<VirtualHost *:1543>

ServerAdmin joey

DocumentRoot "E:/www/API/public"

ServerName localhost:443

ErrorLog "logs/errlog"

CustomLog "logs/accesslog" common

SSLEngine on

SSLCipherSuite RC4-SHA:AES128-SHA:HIGH:MEDIUM:!aNULL:!MD5

SSLCertificateFile "E:/Web/phpStudy/PHPTutorial/Apache/conf/ssl/server.crt"

SSLCertificateKeyFile "E:/Web/phpStudy/PHPTutorial/Apache/conf/ssl/server.key"

<Directory "E:/www/API/public">

Order allow,deny

Allow from all

</Directory>

</VirtualHost>

即修改.htaccess中的端口和VirtualHost 中的端口为网站端口