首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用NGINX设置PHP 7

如何使用NGINX设置PHP 7
EN

Stack Overflow用户
提问于 2015-12-01 04:08:49
回答 1查看 12.6K关注 0票数 1

我在我的开发Debian稳定版上安装了PHP 7 Nightly和Nginx 1.9.7 (主线):

代码语言:javascript
复制
$ curl http://nginx.org/keys/nginx_signing.key | apt-key add -
$ echo -e 'deb http://nginx.org/packages/mainline/debian/ jessie nginx\ndeb-src http://nginx.org/packages/mainline/debian/ jessie nginx' > /etc/apt/sources.list.d/nginx.list
$ echo -e 'deb http://repos.zend.com/zend-server/early-access/php7/repos ubuntu/' > /etc/apt/sources.list.d/php.list
$ apt-get -y update && time apt-get -y dist-upgrade
$ apt-get -y --force-yes install --fix-missing nginx php7-nightly
$ service nginx restart

我在/etc/nginx/conf.d/php.conf (未注释的default.conf)中有这个配置文件。这是原始的default.conf,我只是取消了对PHP fastCGI行的注释:

代码语言:javascript
复制
    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;
        #access_log  /var/log/nginx/log/host.access.log  main;

        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            include        fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }

我还没有在网上找到任何关于如何用PHP7设置Nginx主线的教程。:(

谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-12-01 06:26:44

在快速查看了zend提供的包(您正在安装的包)之后,您必须为init系统(systemd)编写一个脚本来启动和管理php-fpm进程。

二进制文件安装在/usr/local/php7/sbin/php-fpm中。您还必须修改/usr/local/php7/etc中的配置文件。主要的更改是确保fpm有一个监听端口9000上的地址127.0.0.1的池。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34007068

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档