Ubuntu下Nginx开启SSL报错nginx: [emerg] unknown directive "ssl"

  1. 去nginx解压目录下执行
./configure --with-http_ssl_module

报错,没有OpenSSL库
image.png
  1. 安装openssl
apt-get install openssl
apt-get install libssl-dev
./configure --with-http_ssl_module
  1. 执行 make
make
  1. 将原来 nginx 备份
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
  1. 将新的 nginx 覆盖旧安装目录
cp objs/nginx /usr/local/nginx/sbin/nginx 
  1. 再试一下
 /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

成功

参考资料:https://blog.csdn.net/weiyangdong/article/details/80008543

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容