惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 司徒正美
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
Martin Fowler
Martin Fowler
罗磊的独立博客
The GitHub Blog
The GitHub Blog
L
LangChain Blog
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
DataBreaches.Net
宝玉的分享
宝玉的分享
U
Unit 42
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
N
Netflix TechBlog - Medium
The Cloudflare Blog
Microsoft Azure Blog
Microsoft Azure Blog
H
Help Net Security
美团技术团队
大猫的无限游戏
大猫的无限游戏
雷峰网
雷峰网
爱范儿
爱范儿
酷 壳 – CoolShell
酷 壳 – CoolShell
MongoDB | Blog
MongoDB | Blog

不明のNetWorkOS

Libmodsecurity 的安装与使用 使用 GitHub 部署密钥部署代码 Supervisor 的安装与使用 PHP 中的 JIT 配置 IOC 服务容器 Python 使用 virtualenv 部署 flask 项目 Git 基础命令 在 Laravel 中的 Vue 组件无法使用 @apply 的解决方案 [转载] 免费 VPS 大全
在 Nginx 中为 PHP 添加环境变量
不明 · 2021-10-11 · via 不明のNetWorkOS

发布于 2021-10-11 1470 次阅读


nginx 不像 apache 那样管理 php 进程,一般来说,apache 将 php 作为自身的一部分运行,而 nginx 则是将请求通过 unix 套接字返回给 php 。


可以通过设置 fastcgi_param 来设置额外的环境变量

location ~ \.php$ {
    ...
    fastcgi_param APP_ENV production;
    ...
}

也可以通过设置 php 的 fpm 配置文件来设置

...
env[APP_ENV] = production
...