douguangxiang0363
douguangxiang0363
2015-07-30 15:06
浏览 44
已采纳

如何在ubuntu 14.04上运行nginx的多个php版本

I watched a gist on github explains how run multiple versions of php on ubuntu 14.04 with apache.

but how can we get the same result with nginx?

图片转代码服务由CSDN问答提供 功能建议

我看了 gist 解释了如何使用apache在ubuntu 14.04上运行多个版本的php。

但是我们怎样才能得到与nginx相同的结果?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • douyang2530
    douyang2530 2015-07-30 15:11
    已采纳

    Take a look at this website i think it is what you want. How to Run Multiple Versions of PHP on One Server

    点赞 评论
  • duanchi8836
    duanchi8836 2017-08-21 12:24

    In case if you are using Nginx Server:

    If your different applications are in different folders,

    You can try writing nested location tags and write your php configuration based on that.

    For example if a sub folder having an application that needs a php 5.6 version and your root application need a php version that needs php 5.5 version then on your nginx configuration inside the location stanza of your application(say app1) put your copy and paste php execution related stanza relevant to your app.

    example

        server{
    
    location app1{
    
    location  ~ \.php$ {
    ...
        fastcgi_pass 127.0.0.1:9001;
    ..
    }
    
    
    }
    
    location  ~ \.php$ {
    ...
        fastcgi_pass 127.0.0.1:9000;
    ..
    }
    
    }
    

    You have to install multiple php versions and configure its fpm conf to match the port address

    点赞 评论

相关推荐