当前位置: 首页 > news >正文

nginx源码安装配置ssl域名

 nginx源码安装

下载
wget http://nginx.org/download/nginx-1.24.0.tar.gz
解压
tar -zxvf nginx-1.24.0.tar.gz
下载openssl
apt install openssl
安装nginx
cd nginx-1.24.0
sudo apt-get install libpcre3 libpcre3-dev
./configure --prefix=/home/nginx24 --with-http_ssl_module
编译
make install
查看是否安装成功
cd /home/nginx24/sbin
root@cvm-3kdmjix25i223:/home/nginx24/sbin# ./nginx -V
nginx version: nginx/1.24.0
built by gcc 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04) 
built with OpenSSL 3.0.2 15 Mar 2022
TLS SNI support enabled
configure arguments: --prefix=/home/nginx24 --with-http_ssl_module
启动
root@cvm-3kdmjix25i223:/home/nginx24/sbin# ./nginx
访问       
ip:80  查看是否成功

出现

./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=<path> option.

  • For Ubuntu or Debian: Run sudo apt-get install libssl-dev to install the OpenSSL development package.

  • For CentOS or Fedora: Run sudo yum install openssl-devel to install the OpenSSL development package.

  • 然后重新执行./configure --prefix=/home/nginx24 --with-http_ssl_module

nginx配置ssl证书

 1.先购买域名,然后申请ssl证书,下载ssl证书

 

 

 2.配置DNS解析管理

 

3.将解压后的证书放入新创建的ssl文件夹下

root@cvm-3kdmjix25i223:/home/nginx24# mkdir ssl
root@cvm-3kdmjix25i223:/home/nginx24/sbin# cd /home/nginx24/conf/
root@cvm-3kdmjix25i223:/home/nginx24/conf# vim nginx.conf

 修改nginx.conf文件


#user  nobody;
worker_processes  1;#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;#pid        logs/nginx.pid;events {worker_connections  1024;
}http {include       mime.types;
http://www.lryc.cn/news/486159.html

相关文章:

  • 每日一博 - Java的Shallow Copy和Deep Copy
  • .netcore + postgis 保存地图围栏数据
  • 【AI图像生成网站Golang】项目介绍
  • 对称加密算法DES的实现
  • Spring Boot 启动时修改上下文
  • 传奇996_19——常用函数
  • 计算机毕业设计Python+Neo4j知识图谱医疗问答系统 大模型 机器学习 深度学习 人工智能 大数据毕业设计 Python爬虫 Python毕业设计
  • 【Python】如何设置VSCode中的Pylint,消除各种没有必要的警告
  • 游戏引擎学习第14天
  • 关于mysql中的锁
  • 机器学习-4:机器学习的建模流程
  • Android 6年经验面试总结 2024.11.15
  • R语言数据分析可视化——summarytools包的使用
  • 转型一年半,虎牙直播的第二增长曲线喜忧参半
  • makefile笔记
  • Rewar Model的输出(不包含训练)
  • Python调用API翻译Excel中的英语句子并回填数据
  • SQL面试题——抖音SQL面试题 最大在线用户数
  • 前端知识点---Window对象(javascript)了解
  • llama factory lora 微调 qwen2.5 7B Instruct模型
  • 类和对象——拷贝构造函数,赋值运算符重载(C++)
  • Android 关于使用videocompressor库压缩没有声音和异常的问题
  • LeetCode-215.数组中的第K个最大元素
  • 『OpenCV-Python』视频的读取和保存
  • 什么是Spring Boot Actuator
  • 计算机网络:运输层 —— 运输层端口号
  • linux下编译安装memcached
  • 最短路径生成树的数量-黑暗城堡
  • 将已有的MySQL8.0单机架构变成主从复制架构
  • JSON.stringify的应用说明