1.重新安装ssl,过程如下:
第一步:
openssl genrsa -des3 -out server1.key 1024
Generating RSA private key, 1024 bit long modulus
......++++++
........++++++
e is 65537 (0x10001)
Enter pass phrase for server1.key:此处设置个密码
Verifying - Enter pass phrase for server1.key:重新输入设置个密码
第二步:
openssl req -new -key server1.key -out server1.csr
Enter pass phrase for server1.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
第三步:
Country Name (2 letter code) [GB]:CN
State or Province Name (full name) [Berkshire]:Beijing
Locality Name (eg, city) [Newbury]:Beijing
Organization Name (eg, company) [My Company Ltd]:xo
Organizational Unit Name (eg, section) []:xo
Common Name (eg, your name or your server's hostname) []:xo
Email Address []:
Please enter the following 'extra' attributesto be sent with your certificate request
A challenge password []:此处回车
An optional company name []:此处回车:
cp server1.key server1.key.org
第四步:
# openssl rsa -in server1.key.org -out server1.key
Enter pass phrase for server1.key.org:此处输入刚才设置的密码
writing RSA key
第五步:
]# openssl x509 -req -days 365 -in server1.csr -signkey server1.key -out server1.crt
Signature ok
subject=/C=CN/ST=Beijing/L=Beijing/O=xo/OU=xo/CN=xo
Getting Private key2.安装完ssl,
107 (net::ERR_SSL_PROTOCOL_ERROR) 无法与服务器建立安全连接解决方法:
1.重新安装ssl,过程如下:
第一步:
openssl genrsa -des3 -out server1.key 1024
Generating RSA private key, 1024 bit long modulus
......++++++
........++++++
e is 65537 (0x10001)
Enter pass phrase for server1.key:此处设置个密码
Verifying - Enter pass phrase for server1.key:重新输入设置个密码
第二步:
openssl req -new -key server1.key -out server1.csr
Enter pass phrase for server1.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:CN
State or Province Name (full name) [Berkshire]:Beijing
Locality Name (eg, city) [Newbury]:Beijing
Organization Name (eg, company) [My Company Ltd]:xo
Organizational Unit Name (eg, section) []:xo
Common Name (eg, your name or your server's hostname) []:xo
Email Address []:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:此处回车
An optional company name []:此处回车
第三步:
cp server1.key server1.key.org
第四步:
# openssl rsa -in server1.key.org -out server1.key
Enter pass phrase for server1.key.org:此处输入刚才设置的密码
writing RSA key
第五步:
]# openssl x509 -req -days 365 -in server1.csr -signkey server1.key -out server1.crt
Signature ok
subject=/C=CN/ST=Beijing/L=Beijing/O=xo/OU=xo/CN=xo
Getting Private key
2.安装完ssl,配置nginx虚拟主机
server{listen 80;server_name
www.abc.com;root /data0/htdocs/zhaolilei;
index index.html index.php;rewrite ^/
https://www.abc.com permanent;location ~ .*\.(php|php5)
?${#fastcgi_pass unix:/tmp/php-cgi.sock;fastcgi_pass
127.0.0.1:9000;fastcgi_index index.php;include fcgi.conf;
}
access_log /data1/logs/test1.log;
}
server{
listen 443;server_name
www.abc.com;root /data0/htdocs/zhaolilei;
index index.html index.php;ssl on;ssl_certificate server.crt;
ssl_certificate_key server.key;location ~ .*\.(php|php5)?$
{
#fastcgi_pass
unix:/tmp/php-cgi.sock;fastcgi_pass
127.0.0.1:9000;fastcgi_index index.php;include fcgi.conf;
}
access_log /data1/logs/test.log;
}
3.把443的虚拟主机放置到80的上边,重启nginx,即可。