nginx的概述
- 是一个开源的高性能、高可用的web服务(静态资源)、代理服务
- 开源、高并发、高可用、高性能、高扩展性、热部署、缓存
nginx的组成机构
- 二进制可执行文件
- nginx的配置文件
- access.log访问日志
- 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.