Nginx-安装

nginx的概述

  1. 是一个开源的高性能、高可用的web服务(静态资源)、代理服务
  2. 开源、高并发、高可用、高性能、高扩展性、热部署、缓存

nginx的组成机构

  1. 二进制可执行文件
  2. nginx的配置文件
  3. access.log访问日志
  4. error.log错误日志

nginx的安装

  • 安装nginx所依赖的包
[root@nginx rpm-apk]# yum -y install gcc gcc-c++ autoconf pcre pcre-devel make automake httpd-tools
  • 配置nginx的官方yum源

https://nginx.org/en/linux_packages.html#RHEL

[root@nginx]# cat > /etc/yum.repos.d/nginx.repo << OK
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/\$releasever/\$basearch/
gpgcheck=0
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
OK

安装nginx、加入开机自启

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

[root@nginx ~]# systemctl enable nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
[root@nginx ~]# systemctl start nginx

[root@nginx ~]# systemctl status nginx
● nginx.service - nginx - high performance web server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2023-06-08 18:09:08 CST; 5s ago
     Docs: http://nginx.org/en/docs/
  Process: 2247 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
 Main PID: 2248 (nginx)
   CGroup: /system.slice/nginx.service
           ├─2248 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
           └─2249 nginx: worker process

Jun 08 18:09:08 nginx systemd[1]: Starting nginx - high performance web server...
Jun 08 18:09:08 nginx systemd[1]: PID file /var/run/nginx.pid not readable (yet?) afte...rt.
Jun 08 18:09:08 nginx systemd[1]: Started nginx - high performance web server.
Hint: Some lines were ellipsized, use -l to show in full.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

梦有一把琐

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值