首页 > 系统相关 >yum安装nginx-源码编译安装nginx

yum安装nginx-源码编译安装nginx

时间:2023-11-01 23:34:20浏览次数:27  
标签:0.0 nginx 源码 yum root 1.24 安装 yang

#nginx官网

http://nginx.org/

#nginx主要代理七层协议,也就是应用层;nginx是一个高性能HTTP和反向代理,负载均衡服务器.............


#nginx默认端口是80

#https默认端口是443


#官网查看安装步骤

http://nginx.org/——>documentation——>Installing nginx——>Installation on Linux, packages——>RHEL and derivatives——>

#使用yum安装nginx

#配置yum源

vim /etc/yum.repos.d/nginx.repo

[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true


#开始安装

[root@yang-1 ~]# yum install -y nginx


#查看版本

[root@yang-1 ~]# nginx -v
nginx version: nginx/1.24.0


#使用nginx -t检测配置文件时显示默认生成的nginx配置文件

[root@yang-1 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful


#启动服务,查看状态

[root@yang-1 ~]# nginx
[root@yang-1 ~]# ps aux |grep nginx
root      33379  0.0  0.0  48956  1172 ?        Ss   22:06   0:00 nginx: master process nginx
nginx     33380  0.0  0.0  51428  2040 ?        S    22:06   0:00 nginx: worker process
nginx     33381  0.0  0.0  51428  2040 ?        S    22:06   0:00 nginx: worker process
root      33384  0.0  0.0 112724   988 pts/0    R+   22:06   0:00 grep --color=auto nginx
[root@yang-1 ~]#

###

#源码编译部署nginx

#官网下载源码

http://nginx.org/——>documentation——>nginx-1.24.0  pgp


#上传源码文件到linux机器上,到指定目录,或者使用wget下载

[root@yang-1 ~]# cd /usr/local/src/
[root@yang-1 src]# ls
nginx-1.24.0.tar.gz


#安装依赖包

yum install -y gcc-c++
yum install -y zlib zib-devel
yum install -y pcre pcre-devel
yum install -y openssl openssl-devel


#解压

tar -zxvf nginx-1.24.0.tar.gz


#开始预编译

[root@yang-1 src]# cd nginx-1.24.0/
[root@yang-1 nginx-1.24.0]#
[root@yang-1 nginx-1.24.0]#./configure --with-http_ssl_module --with-http_v2_module --with-stream
[root@yang-1 nginx-1.24.0]# echo $?


#./configure预编译成功后,使用make进行编译,或直接执行make && make install

[root@yang-1 nginx-1.24.0]# make
[root@yang-1 nginx-1.24.0]# echo $?


#make编译成功后使用make install进行安装,把编译好的文件复制到系统中去

[root@yang-1 nginx-1.24.0]# make install
[root@yang-1 nginx-1.24.0]# echo $?


#查看所生产的配置文件

[root@yang-1 ~]# whereis nginx
nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/local/nginx /usr/share/nginx /usr/share/man/man8/nginx.8.gz


#启动服务

[root@yang-5 sbin]# cd /usr/local/nginx/sbin
[root@yang-5 sbin]# ./nginx
[root@yang-5 sbin]#
[root@yang-5 sbin]# ps aux |grep nginx
root      13376  0.0  0.0  46220  1160 ?        Ss   22:41   0:00 nginx: master process ./nginx
nobody    13377  0.0  0.0  48756  1992 ?        S    22:41   0:00 nginx: worker process
root      13379  0.0  0.0 112824   988 pts/0    S+   22:41   0:00 grep --color=auto nginx


#停止服务

[root@yang-5 sbin]# /usr/local/nginx/sbin/nginx -s stop


标签:0.0,nginx,源码,yum,root,1.24,安装,yang
From: https://blog.51cto.com/u_15288767/8134179

相关文章

  • DiscuzQ官方最新v3.0.220211源码编译搭建教程和官方部署教程,适合二开(已本地编译通过,无
    经过长达半个月的研究!完成这篇DiscuzQ官方最新版本v3.0.220211的源码编译和官方部署教程。适合喜欢二次开发的小伙伴们,已经通过本地编译测试,保证没有任何错误。具体教程在我搭建的dzq(使用二开方法搭建)发布的文章:https://www.abyssdawn.com/thread/4......
  • Redis安装-Docker版
    Redis安装docker版拉去镜像dockerpullredis准备目录#redis文件配置目录mkdir-p/data/redis/conf#持久化文件存放目录mkdir-p/data/redis/data编写配置文件命名为redis.conf,内容填写如下,将文件放入上面建好的/data/redis/conf目录中。redis配置文件#在redis......
  • “共享书角”图书借还管理系统 小程序-计算机毕业设计源码+LW文档
    小程序框架:uniapp小程序开发软件:HBuilderX小程序运行软件:微信开发者数据库:DROPTABLEIFEXISTSchujiezhe;/*!40101SET@saved_cs_client=@@character_set_client/;/!40101SETcharacter_set_client=utf8/;CREATETABLEchujiezhe(idbigint(20)NOTNULLAUT......
  • “口腔助手”小程序的设计与实现-计算机毕业设计源码+LW文档
    摘 要随着信息时代的来临,过去的“口腔助手”管理方式缺点逐渐暴露,现在对过去的“口腔助手”管理方式的缺点进行分析,采取计算机方式构建“口腔助手”小程序。本文通过阅读相关文献,研究国内外相关技术,提出了一种预约信息管理、“口腔助手”管理于一体的系统构建方案。本文通过采......
  • 大学生党务学习平台-计算机毕业设计源码+LW文档
    摘 要如今社会上各行各业,都喜欢用自己行业的专属软件工作,互联网发展到这个时候,人们已经发现离不开了互联网。新技术的产生,往往能解决一些老技术的弊端问题。因为传统大学生党务学习平台信息管理难度大,容错率低,管理人员处理数据费工费时,所以专门为解决这个难题开发了一个大学生党......
  • 如何在安装 pytorch 的时候,不安装 nvidia 相关的包?
    要在安装PyTorch时避免安装与NVIDIA相关的包,可以使用以下方法:使用CPU版本的PyTorch:PyTorch提供了CPU版本,该版本不需要与NVIDIA相关的包。你可以使用以下命令安装CPU版本的PyTorch:pipinstalltorch-fhttps://download.pytorch.org/whl/cpu/torch_stable.html这将仅安装与CPU兼容......
  • Seata 安装部署
    步骤一:官网下载下载地址:https://github.com/seata/seata/releases步骤二:修改file.conf配置文件解压seata-server-0.9.0.zip下载文件,解压到指定目录并修改conf目录下的file.conf配置文件先备份原始file.conf配置文件主要修改:自定义事务名称+事务日志存储模式为d......
  • 如何在 Deepin 上安装 ONLYOFFICE 桌面编辑器 7.5
    ONLYOFFICE 桌面编辑器是一款基于依据 AGPL v.3 许可进行分发的开源办公套件。使用这款应用,您无需保持网络连接状态即可处理存储在计算机上的文档。本指南会向您介绍,如何在 Deepin上安装 ONLYOFFICE 桌面编辑器。ONLYOFFICE桌面版是什么ONLYOFFICE编辑器桌面版是一款全面......
  • nginx server_name配置多域名的坑
    问题介绍项目配置了多个域名,如下,php代码中有获取 $_SERVER['SERVER_NAME'] 的值server{ server_namea.demo.comb.demo.com;...}当访问a.demo.com时,其获取的值是符合预期的。但是当访问b.demo.com时,其获取的值还是a.demo.com,导致代码中的判断出现错误......
  • tomcat nio2源码分析
    一、前言​ 最近在看tomcatconnector组件的相关源码,对Nio2的异步回调过程颇有兴趣,平时读源码不读,自己读的时候很多流程都没搞明白,去查网上相关解析讲的给我感觉也不是特别清晰,于是就自己慢慢看源码,以下是我自己的见解,因为开发经验也不多,刚成为社畜不久,有些地方讲错如果有大佬......