云原生(四十八) | Nginx软件安装部署

文章目录

Nginx软件安装部署

一、Nginx软件部署步骤

二、安装与配置Nginx


Nginx软件安装部署

一、Nginx软件部署步骤

第一步:安装 Nginx 软件

第二步:把 Nginx 服务添加到开机启动项

第三步:配置 Nginx

第四步:启动Nginx

二、安装与配置Nginx

安装Nginx软件:

bash 复制代码
yum install nginx

把Nginx服务添加到开机启动项

bash 复制代码
systemctl enable nginx

配置Nginx

bash 复制代码
vim /etc/nginx/nginx.conf

server {
        listen       80;
        listen       [::]:80;
        server_name  localhost;
        root /web/wordpress;
        include /etc/nginx/default.d/*.conf;
        location / {
            index index.php index.htm index.html;
        }
        location ~ \.php$ {
            fastcgi_pass 127.0.0.1:9000;  # PHP-FPM 默认监听的地址和端口
            fastcgi_index index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
        ...
  }

配置完成后,启动Nginx

bash 复制代码
systemctl  start  nginx

  • 📢博客主页:https://lansonli.blog.csdn.net
  • 📢欢迎点赞 👍 收藏 ⭐留言 📝 如有错误敬请指正!
  • 📢本文由 Lansonli 原创,首发于 CSDN博客🙉
  • 📢停下休息的时候不要忘了别人还在奔跑,希望大家抓紧时间学习,全力奔赴更美好的生活✨
相关推荐
秋播21 小时前
国内本地WSL2编译rancher源码
云原生
ping某2 天前
为什么 Nginx 明明监听了 80,转发后端时却用了 4xxxx 端口?
后端·nginx
小猿姐2 天前
MySQL Top 10 热点问题 AI 运维实战:从内核诊断到云原生运维
mysql·云原生·aiops
阿里云云原生3 天前
深入内核:拆解 OpenTelemetry eBPF 探针如何优雅地“透视”多语言微服务?
云原生
java_cj4 天前
深入kube-apiserver认证机制:从Bearer Token到mTLS的完整认证链解析
linux·运维·服务器·云原生·容器·kubernetes
難釋懷4 天前
Nginx反向代理中的容错机制
运维·nginx
bloglin999994 天前
Nginx高危漏洞CVE-2021-23017及配置样例
运维·nginx
进阶的小名4 天前
Spring Boot SSE + Nginx 配置:解决 EventSource 不实时返回、连接超时、流式响应被缓冲问题
spring boot·后端·nginx
難釋懷4 天前
Nginx获取客户端真实IP
服务器·前端·nginx
qq_谁赞成_谁反对4 天前
甲方IT的成长之路--nginx实战--2604
服务器·数据库·nginx