I'm trying to setup https on my ubuntu server with NGINX ver 1.4.7 and Phusion Passenger 4.0.41.
I created .key and .csr using these two commands
sudo openssl genrsa -des3 -out server.key 2048
sudo openssl req -new -key server.key -out server.csr
and sent .csr to sslshopper.com guys
Got 3 files:
Root CA Certificate - AddTrustExternalCARoot.crt
Intermediate CA Certificate - USERTrustSecureServerCA.crt
Your COMODO SSL Certificate - subdomain_domain_com.crt
This is how my nginx.conf looks right now
http {
passenger_root /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.41;
passenger_ruby /usr/local/rvm/gems/ruby-2.1.1/wrappers/ruby;
server_names_hash_bucket_size 64;
include mime.types;
default_type application/octet-stream;
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
server {
listen 443 default ssl;
ssl on;
ssl_certificate /opt/nginx/ssl/subdomain_domain_com.crt;
ssl_certificate_key /opt/nginx/ssl/server.key;
server_name app.petosevic.com;
root /var/www/petosevic/public;
passenger_enabled on;
location / {
# set X-FORWARDED_PROTO so ssl_requirement plugin works
proxy_set_header X-FORWARDED_PROTO https;
# standard rails+mongrel configuration goes here.
}
}}
And when I try to start the server, I need to enter the password I entered when I created the .key file. When is accepted, I'm getting the error:
nginx: [emerg] SSL_CTX_use_PrivateKey_file("/opt/nginx/ssl/server.key") failed (SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch)
I'm 100% sure that I sent correct .csr file to sslshopper.com guys, but this looks like they are not match.
What do you think about this?