云原生(四十八) | 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博客🙉
  • 📢停下休息的时候不要忘了别人还在奔跑,希望大家抓紧时间学习,全力奔赴更美好的生活✨
相关推荐
xiaokangzhe1 天前
Nginx核心功能
运维·nginx
还在忙碌的吴小二1 天前
k8s是啥?
云原生·容器·kubernetes
ayaya_mana1 天前
快速安装Nginx-UI:让Nginx管理可视化的高效方案
运维·nginx·ui
zhen241 天前
K8s Service
云原生·容器·kubernetes
kc胡聪聪1 天前
nginx的核心功能
服务器·nginx
sbjdhjd1 天前
RHCE | Web 服务器与 Nginx 全栈详解
linux·nginx·http·云原生·oracle·架构·web
卢傢蕊1 天前
LNAMP 网站架构与部署
运维·nginx·lamp
gbling1 天前
网页多次重定向问题
运维·nginx
qhqh3101 天前
K8S的PV、PVC和storageClass的相关概念及实验
云原生·容器·kubernetes
洛菡夕1 天前
nginx核心功能
linux·nginx