Linux Nginx 配置 SSL 证书支持 HTTPS 访问(参考)

2021-03-07 09:29

阅读:318

标签:temp   ast   nginx安装   isa   ble   start   logs   http   安装   

由于之前(Linux nginx安装与配置(参考))已经安装好了 nginx 所以要重新下载包编译 ssl
1.停止运行 nginx

systemcrl stop nginx.service

2.下载 nginx

cd /home/download
wget http://nginx.org/download/nginx-1.4.4.tar.gz
tar -xvf nginx-1.4.4.tar.gz
cd nginx-1.4.4

3.尝试编译 ssl

./configure --prefix=/home/nginx --with-http_stub_status_module --with-http_ssl_module

这里如果出现以下错误说明未安装 openssl,需要先安装(第四步)再重新执行第三步编译

./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl= option.

出现以下内容则编译成功

Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ md5: using OpenSSL library
+ sha1: using OpenSSL library
+ using system zlib library
+ jemalloc library is disabled

nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx dso module path: "/usr/local/nginx/modules/"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"

4.安装 openssl(出现上述错误执行)

yum -y install openssl openssl-devel

5.编译通过执行 make,不要进行 make install,否则就是覆盖安装

make

6.备份已经安装好的 nginx

cp /home/nginx/sbin/nginx /home/nginx/sbin/nginx.bak

7.将编译好的 nginx 覆盖原有的 nginx

cp /home/download/nginx-1.4.4/objs/nginx /home/nginx/sbin/

8.启动 nginx

systemcrl start nginx.service

9.访问已配置好的 https 页面查看

Linux Nginx 配置 SSL 证书支持 HTTPS 访问(参考)

标签:temp   ast   nginx安装   isa   ble   start   logs   http   安装   

原文地址:https://www.cnblogs.com/chendongbky/p/12887747.html


评论


亲,登录后才可以留言!