腾讯云 Centos 利用yum源安装 nginx 1.20.1

2023-11-01 08:48
文章标签 安装 nginx centos 腾讯 yum 1.20

本文主要是介绍腾讯云 Centos 利用yum源安装 nginx 1.20.1,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

环境

  • CentOS 7.9 (腾讯云服务器)
  • nginx 1.20.1

yum源说明

腾讯云的 CentOS 服务器,用的是腾讯的yum源镜像。
感兴趣的可以去/etc/yum.repos.d中看看。

yum源提供nginx 1.20.1的安装了

shell> yum info nginx
Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-managerThis system is not registered with an entitlement server. You can use subscription-manager to register.Loading mirror speeds from cached hostfile
Installed Packages
Name        : nginx
Arch        : x86_64
Epoch       : 1
Version     : 1.20.1
Release     : 9.el7
Size        : 1.7 M
Repo        : installed
From repo   : epel
Summary     : A high performance web server and reverse proxy server
URL         : https://nginx.org
License     : BSD
Description : Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and: IMAP protocols, with a strong focus on high concurrency, performance and low: memory usage.

安装nginx

shell> yum install -y nginx
  • -y : 不需要询问我,自动安装

检查nginx是否安装

shell> nginx -v
nginx version: nginx/1.20.1

启动nginx

shell> systemctl start nginx

查看nginx是否已启动

shell> systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy serverLoaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)Active: active (running) since Sat 2021-11-06 11:59:58 CST; 2h 38min agoProcess: 25017 ExecReload=/usr/sbin/nginx -s reload (code=exited, status=0/SUCCESS)Main PID: 3407 (nginx)CGroup: /system.slice/nginx.service├─ 3407 nginx: master process /usr/sbin/nginx├─25018 nginx: worker process├─25019 nginx: worker process├─25020 nginx: worker process└─25021 nginx: worker processNov 06 11:59:58 VM-16-8-centos systemd[1]: Starting The nginx HTTP and reverse proxy server...
Nov 06 11:59:58 VM-16-8-centos nginx[3403]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Nov 06 11:59:58 VM-16-8-centos nginx[3403]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Nov 06 11:59:58 VM-16-8-centos systemd[1]: Started The nginx HTTP and reverse proxy server.
Nov 06 14:24:58 VM-16-8-centos systemd[1]: Reloading The nginx HTTP and reverse proxy server.
Nov 06 14:24:58 VM-16-8-centos systemd[1]: Reloaded The nginx HTTP and reverse proxy server.

或者

shell> ps -ef | grep nginx
root      3407     1  0 11:59 ?        00:00:00 nginx: master process /usr/sbin/nginx
nginx    25018  3407  0 14:24 ?        00:00:00 nginx: worker process
nginx    25019  3407  0 14:24 ?        00:00:00 nginx: worker process
nginx    25020  3407  0 14:24 ?        00:00:00 nginx: worker process
nginx    25021  3407  0 14:24 ?        00:00:00 nginx: worker process
root     26944 18502  0 14:38 pts/1    00:00:00 grep --color=auto nginx

6,查看80端口返回的内容

shell> curl localhost:80
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
...
</html>

这篇关于腾讯云 Centos 利用yum源安装 nginx 1.20.1的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/321858

相关文章

nginx -t、nginx -s stop 和 nginx -s reload 命令的详细解析(结合应用场景)

《nginx-t、nginx-sstop和nginx-sreload命令的详细解析(结合应用场景)》本文解析Nginx的-t、-sstop、-sreload命令,分别用于配置语法检... 以下是关于 nginx -t、nginx -s stop 和 nginx -s reload 命令的详细解析,结合实际应

SQL server数据库如何下载和安装

《SQLserver数据库如何下载和安装》本文指导如何下载安装SQLServer2022评估版及SSMS工具,涵盖安装配置、连接字符串设置、C#连接数据库方法和安全注意事项,如混合验证、参数化查... 目录第一步:打开官网下载对应文件第二步:程序安装配置第三部:安装工具SQL Server Manageme

Python中win32包的安装及常见用途介绍

《Python中win32包的安装及常见用途介绍》在Windows环境下,PythonWin32模块通常随Python安装包一起安装,:本文主要介绍Python中win32包的安装及常见用途的相关... 目录前言主要组件安装方法常见用途1. 操作Windows注册表2. 操作Windows服务3. 窗口操作

前端如何通过nginx访问本地端口

《前端如何通过nginx访问本地端口》:本文主要介绍前端如何通过nginx访问本地端口的问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、nginx安装1、下载(1)下载地址(2)系统选择(3)版本选择2、安装部署(1)解压(2)配置文件修改(3)启动(4)

Nginx 重写与重定向配置方法

《Nginx重写与重定向配置方法》Nginx重写与重定向区别:重写修改路径(客户端无感知),重定向跳转新URL(客户端感知),try_files检查文件/目录存在性,return301直接返回永久重... 目录一.try_files指令二.return指令三.rewrite指令区分重写与重定向重写: 请求

Nginx 配置跨域的实现及常见问题解决

《Nginx配置跨域的实现及常见问题解决》本文主要介绍了Nginx配置跨域的实现及常见问题解决,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来... 目录1. 跨域1.1 同源策略1.2 跨域资源共享(CORS)2. Nginx 配置跨域的场景2.1

gitlab安装及邮箱配置和常用使用方式

《gitlab安装及邮箱配置和常用使用方式》:本文主要介绍gitlab安装及邮箱配置和常用使用方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1.安装GitLab2.配置GitLab邮件服务3.GitLab的账号注册邮箱验证及其分组4.gitlab分支和标签的

MySQL MCP 服务器安装配置最佳实践

《MySQLMCP服务器安装配置最佳实践》本文介绍MySQLMCP服务器的安装配置方法,本文结合实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下... 目录mysql MCP 服务器安装配置指南简介功能特点安装方法数据库配置使用MCP Inspector进行调试开发指

nginx启动命令和默认配置文件的使用

《nginx启动命令和默认配置文件的使用》:本文主要介绍nginx启动命令和默认配置文件的使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录常见命令nginx.conf配置文件location匹配规则图片服务器总结常见命令# 默认配置文件启动./nginx

在Windows上使用qemu安装ubuntu24.04服务器的详细指南

《在Windows上使用qemu安装ubuntu24.04服务器的详细指南》本文介绍了在Windows上使用QEMU安装Ubuntu24.04的全流程:安装QEMU、准备ISO镜像、创建虚拟磁盘、配置... 目录1. 安装QEMU环境2. 准备Ubuntu 24.04镜像3. 启动QEMU安装Ubuntu4