When working with Ubuntu/Debian systems, you'll notice that development packages typically follow the lib[package-name]-dev
naming pattern. For OpenSSL, the correct package name is libssl-dev
, not openssl-dev
as you might find in some older documentation.
Here's the correct command to install both OpenSSL and its development headers:
sudo apt-get update
sudo apt-get install openssl libssl-dev
When compiling Nginx from source, the libssl-dev
package provides:
- Header files needed for SSL/TLS functionality
- Static libraries for linking
- Development tools required during compilation
After installation, you can verify the headers are in place:
ls -l /usr/include/openssl/
You should see files like ssl.h
, err.h
, and other OpenSSL headers.
When compiling Nginx, you'll typically include SSL support like this:
./configure --with-http_ssl_module \
--with-openssl=/usr/include/openssl
make
sudo make install
Some developers encounter these issues:
- Using outdated package names (openssl-dev instead of libssl-dev)
- Forgetting to update package lists before installation
- Missing dependencies when compiling (install build-essential first)
When compiling Nginx from source on Ubuntu, many developers encounter confusion regarding the OpenSSL development packages. The book reference mentions openssl-dev
, but Ubuntu's package manager doesn't recognize this exact name.
In Ubuntu/Debian systems, development packages typically follow the lib[package-name]-dev
naming pattern. For OpenSSL, the correct package is:
sudo apt-get install libssl-dev openssl
After installation, verify the headers are properly installed:
ls /usr/include/openssl/
# Should show ssl.h, crypto.h, etc.
When configuring Nginx, ensure it can find the OpenSSL headers:
./configure --with-http_ssl_module \
--with-openssl=/usr/include/openssl \
[other configuration options]
If you encounter SSL-related errors during Nginx compilation:
# Check for missing dependencies
sudo apt-get build-dep nginx
# Verify the OpenSSL version
openssl version
For specific OpenSSL versions, you might need to compile from source:
wget https://www.openssl.org/source/openssl-1.1.1.tar.gz
tar -xzf openssl-1.1.1.tar.gz
cd openssl-1.1.1
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
make
sudo make install
When using custom OpenSSL builds, update your environment variables:
export LD_LIBRARY_PATH=/usr/local/openssl/lib:$LD_LIBRARY_PATH
export PATH=/usr/local/openssl/bin:$PATH