yum -y install libxml2 libxml2-develyum -y install libxslt-devel
yum -y install bzip2-devel
yum -y install curl-devel
yum -y install libjpeg-devel #报什么错误缺少什么扩展请参与此文http://www.poluoluo.com/jzxy/201505/364819.html
# yum install -y pcre pcre-devel
# yum install -y zlib zlib-devel
# yum install -y openssl openssl-devel
# yum install -y gcc gcc-c++
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
/usr/local/nginx/sbin/nginx #启动
/usr/local/nginx/sbin/nginx -s reload #重启
/usr/local/nginx/sbin/nginx -t #配置文件是否正确
#
# The default server
#
server {
listen ;
server_name localhost;
root /usr/local/nginx/html;
location / {
index index.php index.html index.htm;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$ last;
break;
} #if (-f $request_filename/index.php){
# rewrite (.*) $/index.php;
#}
#if (!-f $request_filename){
# rewrite (.*) /index.php;
#}
}
error_page /.html;
location = /.html {
root /usr/local/nginx/html;
}
limit_rate_after 5m;
limit_rate 512k;
location ~ \.mp4$ {
mp4;
mp4_buffer_size 5m;
mp4_max_buffer_size 20m;
}
location = /50x.html {
root /usr/local/nginx/html;
} location ~ ^/files/.*\.(php|php5)$ {
deny all;
} location ~* \.(jpg|jpeg|gif|png|ico|swf)$ {
expires 10y;
access_log off;
gzip off;
} location ~* \.(css|js)$ {
expires 10y;
access_log off;
} location ~ \.php$ {
fastcgi_pass 127.0.0.1:;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
fastcgi_buffer_size 128k;
fastcgi_buffers 128k;
} }

去掉了index.php,rewrite规则在第10行,如果多个php共存的话,改一下每个php的php-fpm.conf配置,将端口设置不同,再在这里面的fastcgi_pass里更改下需要运行的服务器及端口号。

PHP安装:

更换yum源:https://yq.aliyun.com/articles/33286

下载地址:http://php.net/downloads.php

如果是php7的编辑,不用--with-mysql这个选项

./configure --prefix=/usr/local/php --enable-fpm --with-mcrypt=/usr/local/libmcrypt --with-zlib --enable-mbstring --with-openssl --with-mysql --with-mysqli --with-mysql-sock --with-gd --with-jpeg-dir=/usr/lib --enable-gd-native-ttf --enable-pdo --with-pdo-mysql --with-gettext --with-curl --with-pdo-mysql --enable-sockets --enable-bcmath --enable-xml --with-bz2 --enable-zip --with-freetype-dir=/usr/include/freetype2/freetype/
#如果系统默认没有安装freetype
curl -O https://cytranet.dl.sourceforge.net/project/freetype/freetype2/2.3.9/freetype-2.3.9.tar.gz
tar -zxvf freetype-2.3..tar.gz
cd freetype-2.3.
./configure --prefix=/usr/local/freetype
make && make install #安装GD2库或编辑php时,最后加上--with-freetype-dir=/usr/local/freetype/选项,重新编绎PHP请先make clean

php 编辑过程出现各种依赖包错误请查看

#报什么错误缺少什么扩展请参与此文http://www.poluoluo.com/jzxy/201505/364819.html 特别全
php-fpm重启
ps aux | grep php-fpm
root 0.0 0.4 ? Ss : : php-fpm: master process (/usr/local/php/etc/php-fpm.conf)
nobody 0.0 0.4 ? S : : php-fpm: pool www
nobody 0.0 0.4 ? S : : php-fpm: pool www
root 0.0 0.0 pts/ R+ : : grep --color=auto php-fpm
kill -USR2 #kill掉master process

你可以使用--with-config-file-path=/etc
把php.ini存放到/etc下面,然后可以从源码包中拷贝php.ini-dist/php.ini-production到/etc/php.ini。

#添加 PHP 命令到环境变量
vim /etc/profile #在末尾加入
PATH=$PATH:/usr/local/php/bin
export PATH #要使改动立即生效执行
. /etc/profile 或 source /etc/profile #查看环境变量
echo $PATH #查看php版本
php -v PHP 5.5.38 (cli) (built: Jun 1 ::)
Copyright (c) - The PHP Group
Zend Engine v2.5.0, Copyright (c) - Zend Technologies #配置php-fpm
cd /usr/local/php/etc
cp php-fpm.conf.default php-fpm.conf

 用yum安装的时候,默认在/etc/init.d/目录下面会有php-fpm或mysql,编辑安装的时候没有,这个时候需要自己增加服务到/etc/init.d/目录下,再设置开机启动

将nginx,php-fpm加入服务 http://www.jb51.net/article/58796.htm

Centos7 mysql安装参考: https://blog.csdn.net/li_wei_quan/article/details/78549891

nginx配置,php安装的更多相关文章

  1. Nginx 配置 和安装

    Nginx 博客 web服务器和web框架的关系 web服务器(nginx): 接收HTTP请求(例如www.pythonav.cn/xiaocang.jpg)并返回数据 web服务器,仅仅就是 接收 ...

  2. Linux环境下Nginx配置安装PHP

    下边的安装配置方法,我试了一晚上没有成功,可能因为我的系统环境比较复杂,所以建议: 先安装PHP.使用yum命令安装,在安装配置MySQL,具体做法看博客中其他文章,至于Nginx服务器可以安装完这两 ...

  3. centos7 nginx配置httpsCenos(6.6/7.1)下从源码安装Python+Django+uwsgi+nginx环境部署(二)

     1.yum安装nginx 下载对应当前系统版本的nginx包(package) # wget  http://nginx.org/packages/centos/7/noarch/RPMS/ngin ...

  4. Nginx源码安装及调优配置

    导读 由于Nginx本身的一些优点,轻量,开源,易用,越来越多的公司使用nginx作为自己公司的web应用服务器,本文详细介绍nginx源码安装的同时并对nginx进行优化配置. Nginx编译前的优 ...

  5. nginx的配置与安装

    说说在Linux系统下安装配置Nginx的详细过程. 1. 从Nginx官网下载Nginx.目前最新的稳定版为:1.6.2. 2. 将下载下来的Nginx上传到/opt/nginx目录下.运行“tar ...

  6. Nginx与Tomcat安装、配置与优化

    Nginx与Tomcat安装.配置与优化 Nginx与Tomcat安装.配置与优化 Nginx的安装与使用 Nginx是一款优秀的反向代理服务器 安装: rpm(或者是pkg安装),是预编译好的程序包 ...

  7. [转]CENTOS 6.5 配置YUM安装NGINX+服务器负载均衡

    原文连接: CENTOS 6.5 配置YUM安装NGINX  http://blog.sina.com.cn/s/blog_69f467b70102uyux.html 参考博文: Centos下安装. ...

  8. [Linux]于Mac在配置Linuxserver安装Nginx+PHP

    Linux 安装Debian系统 我安装的是Debian7.5的系统,Debian的软件包管理和升级十分方便,并且系统也非常稳定. 安装盘能够去华中科技大学镜像.网易开源镜像站或者中国科技大学镜像下载 ...

  9. nginx的yum安装,基本参数使用,编译参数说明和Nginx基本配置,模块安装

    nginx的yum安装从nginx官网获取源 vim /etc/yum.repose.d/nginx.repo[nginx]name=nginx repobaseurl=http://nginx.or ...

  10. Nginx概述及安装配置

    1.概述 Nginx是一款开源的,高性能的Http和反向代理服务器,同时也是一个IMAP.POP3.SMTP代理服务器:Nginx可以作为一个HTTP服务器进行网站的发布处理,也可以作为反向代理进行负 ...

随机推荐

  1. code#5 P3 我有矩阵,你有吗?

    我有矩阵,你有吗?   时间限制: 1.0 秒 空间限制: 128 MB 相关文件: 题目目录 题目描述 企鹅豆豆手里有两个 01 矩阵 A 和 B.他可以进行两种操作: 选择 A 矩阵的一行,然后把 ...

  2. ABAP术语-World Wide Web

    World Wide Web 原文:http://www.cnblogs.com/qiangsheng/archive/2008/03/21/1115728.html Internet service ...

  3. PHP-掌握基本的分布式架构思想

    虽然说写PHP目前都是接触的业务代码,发现写久了,也要熟悉相应的架构 在高并发,高可用的系统下,都是使用高性能的分布式架构,最近在学习相关知识 分享一张图片: 欢迎关注公众号[phper的进阶之路], ...

  4. Shellinabox on centos6.9

    介绍 一款实用的web linux终端, 并且保证操作安全性(屏蔽root用户) 下面以centos6.9为例 安装 首先安装epel仓库,再安装shellinabox yum -y install ...

  5. 一个C语言萌新的学习之旅(持续更新中...)

    三:计算和类型 一:隐式转换和显示转换 隐式转换:隐式转换指的是自动类型转换,自动向精确,大范围类型转换. 显示转换:例如:(int)3.5*6.0f=18.0f (int)(3.5*6.0f)=21 ...

  6. C语言——第一章,程序设计和C语言

    第一章,程序设计和C语言 一,程序和程序语言 程序:完成某项事物所预设的活动方式和活动过程 程序设计:人们描述(指程序)计算机要做的工作 程序设计语言及发展 1,机器语言    2,汇编语言    3 ...

  7. 使用JSTL的taglib做if判断

    背景:使用springmvc做RESTful风格的CRUD时 问题:使用JSTL的taglib做if判断,未能呈现判断后想要的内容 排查过程: 1.先确定了转发到了正确的jsp文件(在jsp页面中增加 ...

  8. sourcetree的安装及使用

    sourcetree下载地址:https://www.sourcetreeapp.com/ 点击安装包安装 此前需要跳转到bitbucket登录,我没有账号,所以我直接跳转到到https://bitb ...

  9. 20155331 ch02 课下作业

    2.96 遵循位级浮点编码规则,实现具有如下原型的函数: /* *Compute (int)f. *If conversion cause overflow or f is NaN, return 0 ...

  10. 20145234黄斐《Java程序设计》第九周

    教材学习内容总结 整合数据库 JDBC入门 JDBC是用于执行SQL的解决方案,开发人员使用JDBC的标准接口,数据库厂商则对接口进行操作,开发人员无须接触底层数据库驱动程序的差异性,数据库本身是个独 ...