Home  >  Q&A  >  body text

openssl - How to configure nginx to configure SSL security certificate and restart without entering password

Today I configured an SSL security certificate for Nginx

ssl on; 
    ssl_certificate  /home/cert/server.crt;
    ssl_certificate_key  /home/cert/server.key;

Then the password will be required when restarting and reloading. . .

# /usr/local/nginx/sbin/nginx -s reload
Enter PEM pass phrase:

But I have a script that needs to run reload every day, and the password input function cannot be implemented
Is there any way to automatically enter the password?

P.S. I tried the pipe, but nginx couldn’t receive it

阿神阿神2712 days ago983

reply all(2)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-16 17:32:14

    You can do this with a private key. Generate a decrypted key file to replace the original key file.

    openssl rsa -in server.key -out server.key.unsecure

    Then modify the configuration file

    ssl on; 
        ssl_certificate  /home/cert/server.crt;
        ssl_certificate_key  /home/cert/server.key.unsecure;

    This way you don’t have to enter your password

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-16 17:32:14

    Try the expect command, which can be used to enter the password. You can refer to the expect automatic ssh script.

    reply
    0
  • Cancelreply