1. MySQL安装(同LAMP里面的安装方法)
2.  php安装
wget  http://cn2.php.net/distributions/php-5.4.37.tar.bz2
tar jxf php-5.4.37.tar.bz2
useradd -s /sbin/nologin php-fpm                                      #该php以php-fpm形式运行,并且需要创建用户,与之前的LAMP的php运行方式不一样
cd php-5.4.37
./configure --prefix=/usr/local/php   --with-config-file-path=/usr/local/php/etc  --enable-fpm   --with-fpm-user=php-fpm  --with-fpm-group=php-fpm   --with-mysql=/usr/local/mysql  --with-mysql-sock=/tmp/mysql.sock  --with-libxml-dir  --with-gd   --with-jpeg-dir   --with-png-dir   --with-freetype-dir  --with-iconv-dir   --with-zlib-dir   --with-mcrypt   --enable-soap   --enable-gd-native-ttf   --enable-ftp  --enable-mbstring  --enable-exif    --disable-ipv6     --with-curl
make && make install
cp php.ini-production /usr/local/php/etc/php.ini
拷贝启动脚本:
cp /usr/local/src/php-5.4.37/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
mv /usr/local/php/etc/php-fpm.conf.default  /usr/local/php/etc/php-fpm.conf
chmod 755 /etc/init.d/php-fpm
chkconfig --add php-fpm
service php-fpm start
chkconfig php-fpm on
3. 安装nginx
cd /usr/local/src/
wget http://nginx.org/download/nginx-1.6.2.tar.gz
tar zxvf nginx-1.6.2.tar.gz
cd nginx-1.6.2
./configure   --prefix=/usr/local/nginx   --with-pcre
make
make install
启动nginx: 
/usr/local/nginx/sbin/nginx
4. 编写nginx启动脚本
vim /etc/init.d/nginx  //加入如下内容                                
#!/bin/bash
# chkconfig: - 30 21
# description: http service.
# Source Function Library
. /etc/init.d/functions
# Nginx Settings
NGINX_SBIN="/usr/local/nginx/sbin/nginx"
NGINX_CONF="/usr/local/nginx/conf/nginx.conf"
NGINX_PID="/usr/local/nginx/logs/nginx.pid"
RETVAL=0
prog="Nginx"
start() {
        echo -n $"Starting $prog: "
        mkdir -p /dev/shm/nginx_temp
        daemon $NGINX_SBIN -c $NGINX_CONF
        RETVAL=$?
        echo
        return $RETVAL
}
stop() {
        echo -n $"Stopping $prog: "
        killproc -p $NGINX_PID $NGINX_SBIN -TERM
        rm -rf /dev/shm/nginx_temp
        RETVAL=$?
        echo
        return $RETVAL
}
reload(){
        echo -n $"Reloading $prog: "
        killproc -p $NGINX_PID $NGINX_SBIN -HUP
        RETVAL=$?
        echo
        return $RETVAL
}
restart(){
        stop
        start
}
configtest(){
    $NGINX_SBIN -c $NGINX_CONF -t
    return 0
}
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  reload)
        reload
        ;;
  restart)
        restart
        ;;
  configtest)
        configtest
        ;;
  *)
        echo $"Usage: $0 {start|stop|reload|restart|configtest}"
        RETVAL=1
esac
exit $RETVAL
保存后,执行
chmod a+x /etc/init.d/nginx
chkconfig --add nginx
chkconfig nginx on

5. 配置解析php
vim  /usr/local/nginx/conf/nginx.conf   //把下面的配置,前面的#删除,并更改fastcgi_param SCRIPT_FILENAME 那一行

  1. location ~ \.php$ {
  2. root           html;                                          #相对路径
  3. fastcgi_pass   127.0.0.1:9000;
  4. fastcgi_index  index.php;
  5. fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html$fastcgi_script_name;         #/usr/local/nginx/html 是绝对路径
  6. include        fastcgi_params;
  7. }

复制代码

重新加载 /usr/local/nginx/sbin/nginx -s  reload
vim  /usr/local/nginx/html/1.php
增加 
<?php
    phpinfo();
?>
测试: curl localhost/1.php

最新文章

  1. vue-resource初体验
  2. ADC
  3. 三维模型2.5D轮廓提取及遮挡部分的剔除
  4. Storage Keepers
  5. 为oracle中的表格增加列和删除列
  6. 《linux程序设计》笔记 第一章 入门
  7. Linux命令(十四)gdb调试
  8. IE 兼容background-size
  9. 关于DFS和BFS的理解 以及坐标的定义
  10. Android-Recyclerview-使用分割线
  11. CentOS系统下安装 LNAM环境
  12. php自动获取字符串编码函数mb_detect_encoding(转)
  13. [看门狗]基于Linux的嵌入式系统全程喂狗策略
  14. 如何查看Maven项目的jar包依赖
  15. Python3 字典Dict(十三)
  16. Python学习笔记之Centos6.9安装Python3.6
  17. kafka监控搭建
  18. 【转】unity3d 在UGUI中制作自适应调整大小的滚动布局控件
  19. React &amp; `event.persist()`
  20. Linux 安装ngnix

热门文章

  1. Java性能监控之Java程序执行解析
  2. 解决IDEA2018.1.5或者Android Studio 3.0版本的输入法不跟随光标问题
  3. 【bzoj4756】[Usaco2017 Jan]Promotion Counting 离散化+树状数组
  4. [poj] 1204 Word Puzzles || AC自动机
  5. ZOJ 1280 Interesting Lines | 求两直线交点
  6. 《c程序设计语言》读书笔记-5.5-指针实现strncpy,strncat,strncmp
  7. centos 搭建web平台
  8. mysql如何更改character-set-server默认为latin1
  9. 无法安装MVC3,一直卡在vs10-kb2483190
  10. Linux内核实践之序列文件【转】