php-fpm

在ubuntu 11.04上面安装nginx+php5+mysql

不打扰是莪最后的温柔 提交于 2019-12-03 08:29:16
今晚在公司值班,就想着试试装一下php,之前ubuntu装在移动硬盘上直接启动就是了。之前也有装过一个apache给svn用,但发现源码装php相当麻烦,就偷懒一下,直接apt-get,真是简单方便啊! 119 apt-get install mysql-server mysql-client 120 apt-get install nginx 121 /etc/init.d/nginx start 122 apt-get install php5-fpm 注 ubuntu10.04 官方没有php-fpm的源 10.10开始已经有了 加入非官方的源 sudo vim /etc/apt/source.list 加入 deb http: // ppa.launchpad.net/jdub/devel/ubuntu maverick main deb http: // ppa.launchpad.net/brianmercer/php/ubuntu lucid main deb-src http: // ppa.launchpad.net/brianmercer/php/ubuntu lucid main 123 apt-get update(上面执行的时候显示源有点问题) 124 apt-get install php5-fpm 125 vi /etc/nginx/nginx

PHP-fpm 远程代码执行漏洞(CVE-2019-11043)源码分析

扶醉桌前 提交于 2019-12-03 07:07:41
一、漏洞复现 1、搭建docker环境(yum install docker-re) 2、拉取镜像 配置docker-compose.yml文件,并拉取镜像 docker-compose up -d version: '2' services: nginx: image: nginx:1 volumes: - ./www:/usr/share/nginx/html - ./default.conf:/etc/nginx/conf.d/default.conf depends_on: - php ports: - "8080:80" php: image: php:7.1.32-fpm volumes: - ./www:/var/www/html default.conf server { listen 80 default_server; listen [::]:80 default_server; root /usr/share/nginx/html; index index.html index.php; server_name _; location / { try_files $uri $uri/ =404; } location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; include

PHP工作模式详解

ⅰ亾dé卋堺 提交于 2019-12-03 07:01:04
PHP运行模式有4钟: 先了解一下php的SAPI: php的4层结构图: php的工作模式就是与图中的SAPI有关: 关于sapi: Sapi全称是Server Application Programming Interface,也就是服务端应用编程接口,Sapi通过一系列钩子函数,使得PHP可以和外围交互数据,这是PHP非常优雅和成功的一个设计,通过sapi成功的将PHP本身和上层应用解耦隔离,PHP可以不再考虑如何针对不同应用进行兼容,而应用本身也可以针对自己的特点实现不同的处理方式。 1)cgi 通用网关接口(Common Gateway Interface)) 2) fast-cgi 常驻 (long-live) 型的 CGI 3) cli 命令行运行 (Command Line Interface) 4)web模块模式 (apache等web服务器运行的模块模式) 1.CGI(Common Gateway Interface)【 比较老的模式,几乎不怎么用了 】 CGI即通用网关接口(Common Gateway Interface),它是一段程序, 通俗的讲CGI就象是一座桥,把网页和WEB服务器中的执行程序连接起来,它把HTML接收的指令传递给服务器的执行程序,再把服务器执行程序的结果返还给HTML页。CGI 的跨平台性能极佳,几乎可以在任何操作系统上实现。

构建LNMP平台

試著忘記壹切 提交于 2019-12-03 04:00:36
1方案 安装部署Nginx、MariaDB、PHP环境 安装部署Nginx、MariaDB、PHP、PHP-FPM; 启动Nginx、MariaDB、FPM服务; LNMP(Linux、Nginx、MySQL、PHP) 在RHEL7系统中,源码安装Nginx,使用RPM包安装MariaDB、PHP、PHP-FPM软件。 操作过程中需要安装的软件列表如下: nginx mariadb、mariadb-server、mariadb-devel php、php-fpm、php-mysql 备注:mariadb(数据库客户端软件)、mariadb-server(数据库服务器软件)、mariadb-devel(其他客户端软件的依赖包)、php(解释器)、php-fpm(进程管理器服务)、php-mysql(PHP的数据库扩展包)。 步骤一:安装软件 1)使用yum安装基础依赖包 [root@proxy ~]# yum -y install gcc openssl -devel pcre -devel 2)源码安装Nginx(如果前面课程中已经安装Nginx,则忽略这一步) [root@proxy ~]# useradd - s / sbin /nologin nginx [root@proxy ~]# tar -xvf nginx -1.12.2 .tar .gz [root@proxy ~

解决Zend OPcache huge_code_pages: mmap(HUGETLB) failed: Cannot allocate memory报错

纵饮孤独 提交于 2019-12-03 03:29:31
前几日看到鸟哥介绍的 《让你的PHP7更快之Hugepage》 , 于是想试试手给服务器加上,参照格式安装好扩展,调整好配置文件,然后重启php-fpm,结果启动一直报Zend OPcache huge_code_pages: mmap(HUGETLB) failed: Cannot allocate memory 看字面意思是无法分配内存?怎么会呢,机器内存还是很充足的,这点排查掉了。后面查找相关资料得到,是因为系统Hugepage不够,一般系统Hugepage是没有开启的,可以通过下面命令查看 cat /proc/meminfo | grep Huge HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB HugePages_Total是0,加上就可以了,加上办法 sysctl vm.nr_hugepages=128 cat /proc/meminfo | grep Huge HugePages_Total: 128 HugePages_Free: 123 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB 已经加上了,重启php-fpm,问题解决。 参考文章:

Access denied (403) for PHP files with Nginx + PHP-FPM

匿名 (未验证) 提交于 2019-12-03 01:58:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have been spending few hours on that issue and despite the high number of posts related to it, I cannot solve it. I have a Fedora 20 box with Nginx + PHP-FPM that worked quite good until today (after I reloaded php-fpm.service I guess). Nginx is serving static files with no problem, but any PHP file triggers an error 403. The permissions are ok, nginx and php-fpm are running under the user "nginx": root 13763 0.0 0.6 490428 24924 ? Ss 15:47 0:00 php-fpm: master process (/etc/php-fpm.conf) nginx 13764 0.0 0.1 490428 7296 ? S 15:47 0:00 php

How to correctly link php-fpm and Nginx Docker containers?

匿名 (未验证) 提交于 2019-12-03 01:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to link 2 separate containers: nginx:latest php:fpm The problem is that php scripts do not work. Perhaps the php-fpm configuration is incorrect. Here is the source code, which is in my repository . Here is the file docker-compose.yml : nginx: build: . ports: - "80:80" - "443:443" volumes: - ./:/var/www/test/ links: - fpm fpm: image: php:fpm ports: - "9000:9000" and Dockerfile which I used to build a custom image based on the nginx one: FROM nginx # Change Nginx config here... RUN rm /etc/nginx/conf.d/default.conf ADD ./default

nginx errors readv() and recv() failed

匿名 (未验证) 提交于 2019-12-03 01:14:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I use nginx along with fastcgi. I see a lot of the following errors in the error logs readv() failed (104: Connection reset by peer) while reading upstream and recv() failed (104: Connection reset by peer) while reading response header from upstream I don't see any problem using the application. Are these errors serious or how to get rid of them. 回答1: I was using php-fpm in the background and slow scripts were getting killed after a said timeout because it was configured that way. Thus, scripts taking longer than a specified time would get

LNMP环境配置SSL踩坑实录(502 bad gateway)

匿名 (未验证) 提交于 2019-12-03 00:23:01
之前一直使用的是LAMP套装,对nginx配置不是很熟悉,配置SSL过程中踩的坑记录一下 server { listen 80 ; server_name www.domain.com; rewrite ^(. *) https: // $server_name $1 permanent; # 监听80端口 如果发现访问的是80端口 则进行url重写强制跳转到443端口 } server { listen 443 ; server_name www.domain.com; ssl on; ssl_certificate cert/ 1_ www.domain.com_bundle.crt; ssl_certificate_key cert/ 2_ www.domain.com.key; # SSL证书私钥 ssl_session_timeout 5 m ; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1. 1 TLSv1. 2 ; ssl_prefer_server_ciphers on; index index .php index .html index .htm; # 优先解析php文件 #

LNMP环境配置SSL踩坑实录(502 bad gateway)

匿名 (未验证) 提交于 2019-12-03 00:22:01
之前一直使用的是LAMP套装,对nginx配置不是很熟悉,配置SSL过程中踩的坑记录一下 server { listen 80 ; server_name www.domain.com; rewrite ^(. *) https: // $server_name $1 permanent; # 监听80端口 如果发现访问的是80端口 则进行url重写强制跳转到443端口 } server { listen 443 ; server_name www.domain.com; ssl on; ssl_certificate cert/ 1_ www.domain.com_bundle.crt; ssl_certificate_key cert/ 2_ www.domain.com.key; # SSL证书私钥 ssl_session_timeout 5 m ; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1. 1 TLSv1. 2 ; ssl_prefer_server_ciphers on; index index .php index .html index .htm; # 优先解析php文件 #