How to change OPENSSLDIR on Ubuntu?

2019-07-30 20:47发布

问题:

I'm trying to do some configuration so that I can use SSL/HTTPS with the Faraday gem in my Ruby on Rails app. I'm following the directions on the Faraday official site, but I'm stuck on a step. I don't know how to change the value of OPENSSLDIR (see image below). I've looked all over for a command to do this. Any help would be appreciated! My OS is Ubuntu.

回答1:

How to change OPENSSLDIR on Ubuntu?

There are two ways. One way works with all versions of OpenSSL, the second works with OpenSSL 1.0.2 and below.

All OpenSSL

./config ... --prefix=<your install location>

A straight ./config uses /usr/local/ssl as its location. Its the default location.

The difference emerges when you install. make install and make install_sw both install into the location you select. <your install location> is available in OPENSSLDIR, which is defined in <openssl/opensslconf.h>.

OpenSSL 1.0.2 and below

./config ... --openssldir=<your install location>

A straight ./config uses /usr/local/ssl as its location. Its the default location.

make install and make install_sw both install into the location you select. <your install location> is available in OPENSSLDIR, which is defined in <openssl/opensslconf.h>.

IF you use --openssldir with OpenSSL 1.1.0, then make install_sw does not honor your location.