一.下载安装nginx

参见 http://www.cnblogs.com/kreo/p/4378086.html

不再赘述

二.下载php

#下载
wget http://bg2.php.net/distributions/php-5.6.7.tar.gz
#解压
tar zxvf php-5.6.7.tar.gz
#编译
./configure --prefix=/usr/local/php --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=/u01/mysql5.6.23 --enable-mbstring --with-mysqli=/u01/mysql5.6.23/bin/mysql_config

三.启动fastcgi代理模块 php-fpm

初始没有默认配置文件,用default创建一个

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

启动fpm模块

/usr/local/php/sbin/php-fpm

新版本的php-fpm已经不再支持[start|stop|restart]参数命令了,想要关闭重启,需要用kill pid管道方式

#php-fpm 启动:
/usr/local/php/sbin/php-fpm
#php-fpm 关闭:
kill -INT `cat /var/run/php-fpm/php-fpm.pid`
#php-fpm 重启:
kill -USR2 `cat /var/run/php-fpm/php-fpm.pid`

注意 /var/run/php-fpm/php-fpm.pid文件路径是php-fpm.conf定义的,如果没有定义,则用 ps -ef|grep php-fpm得到master进程的pid,然后kill -INT pid

四.配置nginx

server {
listen 80;
server_name localhost;
charset utf-8;
root /u01/php/;
index index.html index.htm index.php;
location / {
}
location ~ \.php$ {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}

CentOS下搭建nginx+php环境的更多相关文章

  1. 在CentOS下搭建Android 开发环境

    在CentOS下搭建Android 开发环境 目录 1.环境搭建 1.1.JDK安装 1.2.Eclipse安装 1.3.ADT安装 1.4.Android SDK安装 1.5.Android NDK ...

  2. Centos下搭建 nginx+uwsgi+python

    python做web应用最麻烦的还是配置服务器了,此话不假,光中间件就有好几种选择,fastcgi.wsgi.uwsgi,难 免让人眼花缭乱. 而听说uwsgi的效率是fastcgi和wsgi的10倍 ...

  3. PHP-Windows下搭建Nginx+PHP环境

    项目中光用Nginx了, 由于有运维人员, 很少搭建Nginx服务器, 开发也就用用Apache, 搭过几次Nginx也忘的快, 每次都去翻别人博客, 今天重搭特此记录, 装前最好了解下FastCGI ...

  4. 【OpenCV】 在CentOS下搭建OpenCV开发环境

    最近开始入模式识别的坑,自然被迫上OpenCV了. 在多次尝试给VS2015扩展Windows 10 SDK无果后(不要问我为啥..VS2015开发C++的标准库全给扔到这个SDK里了,打包在VS安装 ...

  5. Centos下搭建nginx反向代理

    上一节已经用编译的方式搭建好了一个nginx,链接在下面 https://www.toutiao.com/i6693130510777975300/ 然后这次我们把上次搭建好的nginx作为反向代理的 ...

  6. Linux下搭建nginx php环境

    下载安装所需包 openssl-1.0.1i.tar.gz zlib-1.2.8.tar.gz pcre-8.35.tar.gz nginx-1.7.4.tar.gz 以上为nginx依赖文件 lib ...

  7. centos下搭建openstack的环境

    一.准备环境 linux (centos 7.2(C300的虚机) ) java1.8 官网下载tar包 安装前设置环境变量 JAVA_HOME=/usr/lib/jvm/java-1.8.0-ope ...

  8. 在CentOS下搭建GoLang开发环境

    下载安装包 [vagrant@dk ~]$ wget http://mirrors.ustc.edu.cn/golang/go1.13.linux-amd64.tar.gz 使用USTC 中科大开源镜 ...

  9. CentOS下搭建LAMP环境详解

    前言:在这里将介绍如何在CentOS下搭建LAMP环境(全部使用源码编译安装),用于web服务器开发. •LAMP: Linux + Apache + PHP + Mysql. •系统: CentOS ...

随机推荐

  1. HDU2191(多重背包)

    #include <cstdio> #include <cstring> #include <algorithm> #include <iostream> ...

  2. CodeForceS#276-A

    A. Factory   One industrial factory is reforming working plan. The director suggested to set a mythi ...

  3. pointers on c (day 1,chapter1)

    c语言的优先级 优先级 运算符 名称或含义 使用形式 结合方向 说明 1 [] 数组下标 数组名[常量表达式] 左到右 () 圆括号 (表达式)/函数名(形参表) . 成员选择(对象) 对象.成员名 ...

  4. Linux下使用vsftp

    参考网址: http://wenku.baidu.com/view/4339434bc850ad02de80419c.html?re=view root用户无法ftp登录,显示530 Permissi ...

  5. 使用linux命令行配置无线网链接

    1. 需安装wpa_supplicant https://wiki.archlinux.org/index.php/WPA_Supplicant_%28%E7%AE%80%E4%BD%93%E4%B8 ...

  6. [iOS-UI]给输入框添加清除按钮的代码

    UIButton *clearButton = [self.textField valueForKey:@"_clearButton"]; [clearButton setImag ...

  7. js小效果-双色球

    <!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8" ...

  8. [译]FastClick: native-like tapping for touch apps

    原文地址:http://labs.ft.com/2011/08/fastclick-native-like-tapping-for-touch-apps/ 这篇文章是一篇老文了,现在才看到,真是落后啊 ...

  9. 通过串口设备vid,pid自动获得该设备所对应的串口号

    用C#做串口通讯很方便,因为dotfx2.0已经集成了Serial Port控件,此控件使用上比MSComm控件更简单,当然它也有一个小bug (RecievedBytesThreshold设置有时候 ...

  10. 【转】Selenium WebDriver + Python 环境

    转自:http://www.myext.cn/webkf/a_11878.html 1. 下载必要工具及安装包 1.1 [Python开发环境] 下载并安装Python 2.7.x版本 下载地址:ht ...