• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

php5-fpm怎么安装

php 搞代码 4年前 (2022-01-04) 22次浏览 已收录 0个评论

安装php5-fpm的方法:首先安装nginx,并建立nginx用户;然后修改nginx配置文件以支持php-fpm;接着通过“apt-get -y install”命令php5-fpm及php;最后修改php-fpm配置文件即可。

本文操作环境:debian7.8系统、PHP5版,DELL G3电脑

nginx+php5-fpm安装

一、基础环境

1、 cat  /etc/debian_version 
7.8
 
2、 uname  -r
3.2.0-4-amd64
 
3、ip(eth0)
10.0.0.109

4、nginx版本

1.4.7

二、安装nginx

1、安装所需要的基础包

apt-get -y  install  libpcre3-dev libp<strong style="color:transparent">来源gaodaima#com搞(代@码网</strong>cre3 libssl-dev zlib1g-dev  make

2、建立nginx用户

1)groupadd nginx
2) useradd  nginx -g nginx -s  /bin/false

3、下载nginx

axel -n 10 http: //nginx .org /download/nginx-1 .4.7. tar .gz

4、解压

tar  zxvf nginx-1.4.7. tar .gz &&  cd  nginx-1.4.7

5、编译三部曲

1). /configure  --prefix= /opt/nginx  --user=nginx --group=nginx --with-http_ssl_module
2) make  &&  make  install

6、参数说明

--prefix= /opt/nginx     将安装路径指定在 /opt/nginx 
http_ssl_module         https协议模块
http_gzip_module        压缩的HTTP服务器的响应模块
http_rewrite_module     重写模块
--user=nginx            nginx用户 
--group=nginx           nginx组

7、为了方便 弄个软链接

ln  -s  /opt/nginx/sbin/nginx  /usr/local/sbin/nginx

【推荐:PHP视频教程】

8、修改nginx配置文件以支持php-fpm

1)先备份下

cp  /opt/nginx/conf/nginx .conf  /opt/nginx/conf/nginx .conf.bak

2)修改以下内容

2c2
< user nginx;
---
>  #user  nobody;
36,39c36,38
<         listen       10.0.0.109:80;
<         server_name  10.0.0.109;
<         access_log  /opt/nginx/logs/10 .0.0.109.access.log;
<         error_log  /opt/nginx/logs/10 .0.0.109.error.log;
---
>         listen       80;
>         server_name  localhost;
> 
66,72c65,71
<         location ~ \.php$ {
<             root           html;
<             fastcgi_pass   unix: /run/shm/php5-fpm .sock;
<             fastcgi_index  index.php;
<             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
<             include        fastcgi_params;
<         }
---
>          #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;
>          #}

9、启动nginx服务

nginx

10、查看端口和进程

1) netstat  -tupnl| grep  nginx
tcp        0      0 10.0.0.109:80           0.0.0.0:*               LISTEN      13852 /nginx : master
2) ps  -ef | grep  nginx
root     13852     1  0 22:51 ?        00:00:00 nginx: master process nginx
nginx    13853 13852  0 22:51 ?        00:00:00 nginx: worker process
nginx    13907 13906  0 22:52 ?        00:00:00 php-fpm: pool www                                         
nginx    13908 13906  0 22:52 ?        00:00:00 php-fpm: pool www

PS:

1、停止nginx服务

nginx -s quit

2、重新加载配置

nginx -s reload

搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:php5-fpm怎么安装

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址