/ 中存储网

Apache迁移至Nginx后的ssl配置

2014-03-22 16:30:02 来源:ITJS.CN
APACHE的SSL配置实例

<IfModule mod_ssl.c>

<VirtualHost 85.85.171.15:443>

SSLEngine on

SSLOptions +StrictRequire

SSLCertificateKeyFile /etc/apache2/ssl/server.key

SSLCertificateFile /etc/apache2/ssl/server110.com.crt

#SSLCACertificateFile /etc/apache2/ssl/sf_bundle.crt

#SSLCertificateFile /etc/apache2/ssl/server.crt

#SSLCertificateKeyFile /etc/apache2/ssl/server.key

ServerName www.server110.com

#ServerName www.server110.co.uk

DocumentRoot /home/www/server110/

</VirtualHost>

</IfModule>

<VirtualHost 85.35.73.151:443>

#        ServerName server110.co.uk

ServerName server110.com

redirectmatch 301 ^(.*) https://www.server110.com$1

DocumentRoot /home/www/server110/

</VirtualHost>

nginx 的配置实例

server

{

listen 443;

ssl on;

ssl_certificate /etc/nginx/ssl/server110/server110.com.crt;

ssl_certificate_key /etc/nginx/ssl/server110/server.key;

server_name server110.co.uk www.server110.co.uk server110.com www.server110.com;

if ($host = ’server110.com’ ) {

rewrite  ^(.*)  https://www.server110.com$1 permanent;

#proxy_set_header Host "server110.com";

}

if ($host = ’server110.co.uk’ ) {

rewrite  ^(.*)  https://www.server110.co.uk$1 permanent;

#proxy_set_header Host "server110.com";

}

index  index.php index.html;

root  /home/www/server110/;

location ~ .*.(php|php5)?$

{

fastcgi_pass  127.0.0.1:9000;

fastcgi_index index.php;

include fastcgi_params;

}

location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$

{

expires      30d;

}

location ~ .*.(js|css)?$

{

expires      12h;

}

}

debain系统下apache的SSL配置运行正常,centos系统 下nginx的SSL配置运行正常。