OpenResty(5)--PHP

来源:互联网 发布:阿里云呼叫中心 编辑:程序博客网 时间:2024/03/28 23:52

OpenResty集成PHP

本例:Ubuntu OS

1.install php5

apt-get install php5


2.install php5-fpm

apt-get install php5-fpm


3.update php5-fpm listen

cd /etc/php5/fpm/pool.d

vim www.conf

;listen = /var/run/php5-fpm.sock

listen = 127.0.0.1:9000


4.update nginx.conf

cd /usr/local/openresty/nginx/conf

vim nginx.conf

在server里增加

location ~\.php$ {            root /var/www;            fastcgi_pass 127.0.0.1:9000;            fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;            include fastcgi_params;}

5.add /var/www directory

mkdir /var/www


6.add index.php

cd /var/www

vim index.php

<?php   phpinfo();?>


7.start php5-fpm & restart nginx

/etc/init.d/php5-fpm

/usr/local/openresty/nginx/sbin/nginx -s reload

lsof -i:9000

curl http://localhost/index.php









0 0
原创粉丝点击