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

Nginx 开源版安装

下载 tar.gz安装包,上传。
解压

[root@localhost ~]# tar zxvf nginx-1.21.6.tar.gz
nginx-1.21.6/
nginx-1.21.6/auto/
nginx-1.21.6/conf/
nginx-1.21.6/contrib/
nginx-1.21.6/src/
... ...

安装gcc

[root@localhost nginx-1.21.6]# yum install -y gcc
已加载插件:fastestmirror
Determining fastest mirrors* base: mirrors.nju.edu.cn* extras: mirrors.nju.edu.cn* updates: mirrors.nju.edu.cn
base                                                                                                                                                                 

进入Nginx 目录,配置

# 后面是安装目录
[root@localhost nginx-1.21.6]# ./configure --prefix=/usr/local/nginx

安装 perl 库
yum install -y pcre pcre-devel

安装zlib库
yum install -y zlib zlib-devel

编译

./configure --prefix=/usr/local/nginxmake
make install

查看

[root@localhost nginx-1.21.6]# cd /usr/local/
[root@localhost local]# ls
bin  etc  games  include  lib  lib64  libexec  nginx  sbin  share  src[root@localhost local]# cd nginx/sbin/
[root@localhost sbin]# ls
nginx
# 启动nginx
[root@localhost sbin]# ./nginx

配置系统服务
vi /usr/lib/systemd/system/nginx.service

服务脚本内容

[unit]
Description=nginx - web server
After=network.target remote-fs.target nss-Tookup,target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
ExecQuit=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true
[Install]
wantedBy=multi-user.target

重新加载系统服务
选择语言
systemctl daemon-reload

systemctl start nginx 
systemctl status nginx
systemctl reload nginx
systemctl stop nginx
http://www.lryc.cn/news/241939.html

相关文章:

  • 『亚马逊云科技产品测评』活动征文|低成本搭建物联网服务器thingsboard
  • 【Pytorch】Visualization of Feature Maps(3)
  • 人工智能对我们的生活影响
  • Mysql存储引擎分类
  • 基于Python+TensorFlow+Django的交通标志识别系统
  • 【Java 进阶篇】Jedis:让Java与Redis轻松对话的利器
  • 【数据分享】我国12.5米分辨率的DEM地形数据(免费获取/地理坐标系)
  • C++设计模式之策略模式
  • spring-webflux的一些概念的理解
  • OpenCV快速入门:特征点检测与匹配
  • 旋转的数组
  • Hive VS Spark
  • SAST静态分析工具所支持的规则
  • torch 的数据加载 Datasets DataLoaders
  • 【Promise】某个异步方法执行结束后 在执行下面方法
  • 任意文件下载漏洞(CVE-2021-44983)
  • C++(20):通过source_location实现日志函数
  • 【数据结构】树与二叉树(廿二):树和森林的遍历——后根遍历(递归算法PostOrder、非递归算法NPO)
  • 精通Nginx(17)-安全管控之防暴露、限制访问、防DDos攻击、防爬虫、防非法引用
  • STM32 Flash
  • 文件批量重命名技巧:图片文件名太长怎么办?告别手动改名方法
  • 微信小程序手写滑动tab
  • 一文读懂如何安全地存储密码
  • 【运维面试100问】(六)buffer和cache的区别
  • 创建域名邮箱邮件地址的方法与步骤
  • Qt框架学习(1)
  • 3D电路板在线渲染案例
  • ResizeObserver loop limit exceeded报错解决方案
  • 【OpenCV实现图像:使用OpenCV进行图像处理之透视变换】
  • Vue中学习笔记-数据代理