分类: LINUX
2009-12-18 18:54:17
To generate dummy certficates you can do this steps:
$ cd /usr/local/nginx/conf
$ openssl genrsa -des3 -out server.key 1024
$ openssl req -new -key server.key -out server.csr
$ cp server.key server.key.org
$ openssl rsa -in server.key.org -out server.key
$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
Configure the new certificate into nginx.conf:
{
YOUR_DOMAINNAME_HERE;
443;
on;
/usr/local/nginx/conf/.crt;
/usr/local/nginx/conf/.key;
}
Restart Nginx.
Now all ready to access using:
上面这种自己建的证书用firefox打开会有个提示:YOUR_DOMAINNAME_HERE 使用了无效的安全证书。该证书仅对下列名称有效:
{用IE访问没有提示了,但用firefox访问时,提示:https sec_error_unknown_issuer,这个问题的原因是由于nginx没有配置中级根证书造成的。解决方法如下:
YOUR_DOMAINNAME_HERE;
443;
on;
/usr/local/nginx/conf/.crt;
/usr/local/nginx/conf/.key;
}
{再重启就测试就不会有错误提示了。
YOUR_DOMAINNAME_HERE;
443;
on;
/usr/local/nginx/conf/.pem;
/usr/local/nginx/conf/.key;
}
chinaunix网友2010-04-03 16:26:01
YOUR_DOMAINNAME_HERE已改为我的域名,而且运行了kill -HUP `cat /usr/local/nginx/logs/nginx.pid`以重启nginx
chinaunix网友2010-04-03 16:23:41
我用如下命令设置https,为什么设置https无效呢? $ cd /usr/local/nginx/conf $ openssl genrsa -des3 -out server.key 1024 $ openssl req -new -key server.key -out server.csr $ cp server.key server.key.org $ openssl rsa -in server.key.org -out server.key $ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt Configure the new certificate into nginx.conf: server { server_name YOUR_DOMAINNAME_HERE; listen 443; ssl on; ssl_certificate /usr/local/nginx/conf/server