网站首页 > 技术教程 正文
1、环境准备
2、配置
- nginx.conf文件在/usr/local/nginx/conf
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 81;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/php/$fastcgi_script_name; #当请求资源是php后缀的文件时,在目录/data/php中查找
include fastcgi_params;
}
}
}
- php-fpm保持默认状态
3、运行
3.1、启动php-fpm
- /usr/local/php/sbin/php-fpm
3.2、启动nginx
- /usr/local/nginx/sbin/nginx
3.3、浏览器访问
- 编写php文件-index.php
<?php
echo "hello world.";
- curl访问or浏览器访问
4、流程
4.1、流程图
4.2、文字描述如下
- 访问http://192.168.0.200:81/index.php
- Nginx查看nginx.conf配置文件
- 加载nginx的fast-cgi模块
- php-fpm 监听127.0.0.1:9000
- php-fpm 接收到请求,启用worker进程处理请求
- php-fpm 处理完请求,返回给nginx
- nginx将结果通过http返回给浏览器
猜你喜欢
- 2024-10-14 php手把手教你做网站(二十七)nginx 负载均衡配置
- 2024-10-14 Laravel nginx 配置(nginx l4)
- 2024-10-02 如何在 Ubuntu 22.04 上安装、配置、使用 Nginx?
- 2024-10-02 Nginx配置(nginx配置websocker连接)
- 2024-10-02 PHP+Nginx部署配置文件正确优化改良详解
- 2024-10-02 php Nginx配置(nginx配置php环境)
你 发表评论:
欢迎- 08-06linux 和 windows文件格式互相转换
- 08-06谷歌 ChromeOS 已支持 7z、iso、tar 文件格式
- 08-06Linux下比较文件内容的6种方法
- 08-06文件格式及功能汇总
- 08-0610个Linux文件内容查看命令的实用示例
- 08-06Linux-如何区分不同文件类型
- 08-06Zabbix技术分享——监控windows进程资源使用情况
- 08-06Linux系统卡顿?学会ps命令这三招,轻松定位问题进程
- 最近发表
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)