加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 使用php-fpm的上游和位置有什么区别?

发布时间:2020-12-13 18:13:45 所属栏目:Linux 来源:网络整理
导读:我一直在寻找,但找不到一个直接的答案,如果有人可以请澄清这一点,将不胜感激,谢谢! location ~ .php${ try_files $uri = 404; fastcgi_pass unix:/run/php-fpm/php-fpm.sock; fastcgi_index index.php; include fastcgi.conf;} OR / AND? upstream php {
我一直在寻找,但找不到一个直接的答案,如果有人可以请澄清这一点,将不胜感激,谢谢!
location ~ .php${
    try_files      $uri = 404;
    fastcgi_pass   unix:/run/php-fpm/php-fpm.sock;
    fastcgi_index  index.php;
    include        fastcgi.conf;
}

OR / AND?

upstream php {
    server         unix:/run/php-fpm/php-fpm.sock;
}

谢谢!

解决方法

我发现,至少从nginx 1.6.2开始,我对于位置块的工作语法是:
location ~ .php${
    try_files      $uri = 404;
    fastcgi_pass   php;
    fastcgi_index  index.php;
    include        fastcgi.conf;
}

即:在引用php后端之前,不应指定http://协议.http:// php语法将与proxy_pass指令一起使用,而不是fastcgi_pass.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读