1 创建用户、网站目录和下载相关的安装包
  groupadd www #添加www组

创建目录/data/www/

chown www:www /data/www/ -R #设置目录所有者

chmod 700 /data/www -R #设置目录权限

useradd -g www www -s /bin/false #创建nginx运行账户www并加入到www组,不允许www用户直接登录系统

下载:libmcrypt-2.5.8.tar.gz、php-5.6.0.tar.gz 、nginx-1.7.4.tar.gz、openssl-1.0.1i.tar.gz、pcre-8.35.tar.gz、zlib-1.2.8.tar.gz 并复制到 /usr/local/ 目录

2 安装php5.6.0

添加依赖应用
yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses curl openssl-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel

安装加密扩展库

cd /usr/local/
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
make install

cd /usr/local/
tar zxvf php-5.6.0.tar.gz
cd php-5.6.0
./configure --prefix=/usr/local/php --enable-fasecgi --enable-fpm --with-ncurses --enable-soap --with-libxml-dir --with-XMLrpc --with-openssl --with-mcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --enable-json --enable-mbstring --disable-mbregex --disable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sqlite-utf8 --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --with-pear
make && make install

cp php.ini-production /usr/local/php/etc/php.ini #复制php配置文件到安装目录
rm -rf /etc/php.ini #删除系统自带配置文件
ln -s /usr/local/php/etc/php.ini /etc/php.ini #添加软链接
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf #拷贝模板文件为php-fpm配置文件

vi /usr/local/php/etc/php-fpm.conf #编辑修改
user = www #设置php-fpm运行账号为www
group = www #设置php-fpm运行组为www
pid = run/php-fpm.pid #取消前面的分号

设置 php-fpm开机启动

cp /usr/local/php-5.6.0/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm #拷贝php-fpm到启动目录
chmod +x /etc/rc.d/init.d/php-fpm #添加执行权限
添加到自启动# echo "/etc/rc.d/init.d/php-fpm start">>/etc/rc.local
chkconfig php-fpm on #设置开机启动

3 安装nginx-1.7.4

zlib:主要用于支持将http内容进行gzip压缩,用于减少网络传输流量
cd /usr/local #选定安装的目录
wget http://zlib.net/zlib-1.2.8.tar.gz
tar -zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure
make
make install

pcre:用于支持nginx的正则表达式,配置文件中都需要用到正则表达式
cd /usr/local
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.gz
tar -zxvf pcre-8.35.tar.gz
cd pcre-8.35
./configure
make
make install

openssl:用于nginx支持https请求
cd /usr/local
wget http://www.openssl.org/source/openssl-1.0.1i.tar.gz
tar -zxvf openssl-1.0.1i.tar.gz
cd openssl-1.0.1i
./configure
make
make install

cd /usr/local
tar -zxvf nginx-1.7.4.tar.gz
cd nginx-1.7.4
./configure --prefix=/usr/local/nginx --with-pcre=/usr/local/pcre-8.35 --with-zlib=/usr/local/zlib-1.2.8 --with-openssl=/usr/local/openssl-1.0.1i
make
make install

修改/usr/local/nginx/conf/nginx.conf

  1. user www www;
  2. worker_processes 2;
  3. #error_log logs/error.log;
  4. #error_log logs/error.log notice;
  5. #error_log logs/error.log info;
  6. pid /var/run/nginx.pid; #修改
  7. events {
  8. worker_connections 1024;
  9. }
  10. http {
  11. include mime.types;
  12. default_type application/octet-stream;
  13. sendfile on;
  14. #tcp_nopush on;
  15. #keepalive_timeout 0;
  16. keepalive_timeout 65;
  17. #gzip on;
  18. server {
  19. listen 8090;
  20. server_name localhost;
  21.    index index.php index.html index.htm;
  22. #charset koi8-r;
  23. #access_log logs/host.access.log main;
  24. location / {
  25. root /data/www;
  26. index index.html index.htm;
  27. }
  28. #error_page 404 /404.html;
  29. # redirect server error pages to the static page /50x.html
  30. error_page 500 502 503 504 /50x.html;
  31. location = /50x.html {
  32. root html;
  33. }
        #添加ssdb web
  34.   location /phpssdbadmin {
  35.   root /data/www;
  36. try_files $uri $uri/ /phpssdbadmin/index.php?$args;
  37.   }
  38. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  39. #
  40. location ~ \.php$ {
  41. root /data/www;
  42. fastcgi_pass 127.0.0.1:9000;
  43. fastcgi_index index.php;
  44. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  45. include fastcgi_params;
  46. }
  47. }
  48. }

手动管理: 

启动: /usr/local/nginx/sbin/nginx
停止:kill -QUIT `cat /var/run/nginx.pid`
重启:kill -HUP `cat /var/run/nginx.pid`

开机自动启动Nginx(通过Shell脚本管理):
vi /etc/init.d/nginx #输入下面的代码并保存退出

  1. #!/bin/bash
  2. # nginx Startup script for the Nginx HTTP Server
  3. # it is v.0.0.2 version.
  4. # chkconfig: - 85 15
  5. # description: Nginx is a high-performance web and proxy server.
  6. # It has a lot of features, but it's not for everyone.
  7. # processname: nginx
  8. # pidfile: /var/run/nginx.pid
  9. # config: /usr/local/nginx/conf/nginx.conf
  10. nginxd=/usr/local/nginx/sbin/nginx
  11. nginx_config=/usr/local/nginx/conf/nginx.conf
  12. nginx_pid=/var/run/nginx.pid
  13. RETVAL=0
  14. prog="nginx"
  15. # Source function library.
  16. . /etc/rc.d/init.d/functions
  17. # Source networking configuration.
  18. . /etc/sysconfig/network
  19. # Check that networking is up.
  20. [ ${NETWORKING} = "no" ] && exit 0
  21. [ -x $nginxd ] || exit 0
  22. # Start nginx daemons functions.
  23. start() {
  24. if [ -e $nginx_pid ];then
  25. echo "nginx already running...."
  26. exit 1
  27. fi
  28. echo -n $"Starting $prog: "
  29. daemon $nginxd -c ${nginx_config}
  30. RETVAL=$?
  31. echo
  32. [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
  33. return $RETVAL
  34. }
  35. # Stop nginx daemons functions.
  36. stop() {
  37. echo -n $"Stopping $prog: "
  38. killproc $nginxd
  39. RETVAL=$?
  40. echo
  41. [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid
  42. }
  43. # reload nginx service functions.
  44. reload() {
  45. echo -n $"Reloading $prog: "
  46. #kill -HUP `cat ${nginx_pid}`
  47. killproc $nginxd -HUP
  48. RETVAL=$?
  49. echo
  50. }
  51. # See how we were called.
  52. case "$1" in
  53. start)
  54. start
  55. ;;
  56. stop)
  57. stop
  58. ;;
  59. reload)
  60. reload
  61. ;;
  62. restart)
  63. stop
  64. start
  65. ;;
  66. status)
  67. status $prog
  68. RETVAL=$?
  69. ;;
  70. *)
  71. echo $"Usage: $prog {start|stop|restart|reload|status|help}"
  72. exit 1
  73. esac
  74. exit $RETVAL

chmod 775 /etc/rc.d/init.d/nginx #赋予文件执行权限

chkconfig nginx on #设置开机启动
echo "/etc/rc.d/init.d/nginx start">>/etc/rc.local

启动服务:
/usr/local/php/sbin/php-fpm start
/etc/rc.d/init.d/nginx start

CentOS 7.0默认使用的是firewall作为防火墙。
关闭firewall:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动

测试php:
在/data/www/目录下创建test.php

  1. <?php
  2. phpinfo();
  3. ?>

浏览器( 注意端口要和配置的一致):http://127.0.0.1:8090/test.php

centos7 安装php5.6.0 、nginx1.7.4、phpssdbadmin的更多相关文章

  1. RHEL7或CentOS7安装11.2.0.4 RAC碰到的问题

    RHEL7或CentOS7安装11.2.0.4 RAC碰到的问题 随着Linux 版本的普及,但Oracle数据库主流版本仍是11gR2, 的支持不很完美,在Linux 上安装会遇到几处问题,以此记录 ...

  2. centos编译安装php5.6.20+nginx1.8.1+mysql5.6.17

    LNMP 代表的就是:Linux系统下Nginx+MySQL+PHP这样的站点服务器架构. 本次实践需求: 实践centos6.5编译安装 LNMP生产环境 架构 web生产环境 使用 xcache ...

  3. centos7 安装php5.6

    1.查看centos 版本 lsb_release -a LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-no ...

  4. centos7安装kafka_2.11-1.0.0 新手入门

    系统环境 1.操作系统:64位CentOS Linux release 7.2.1511 (Core) 2.jdk版本:1.8.0_121 3.zookeeper版本:zookeeper-3.4.9. ...

  5. Win2003下安装PHP5.2.0+MySql5.0.27+PHPMyAdmin2.9.1的配置方法

    先下载所需要安装的东东~~ PHP 5.2.0 官方下载地址:http://www.php.net/downloads.php mysql-5.0.27 官方下载地址:http://dev.mysql ...

  6. CentOS7 安装MongoDB 3.0服务器

    1,下载&安装 MongoDB 3.0 正式版本发布!这标志着 MongoDB 数据库进入了一个全新的发展阶段,提供强大.灵活而且易于管理的数据库管理系统.MongoDB宣称,3.0新版本不只 ...

  7. MongoDB 3.0(1):CentOS7 安装MongoDB 3.0服务

    目录(?)[-] 1下载安装 2MongoDB CRUD 1创建数据 2更新数据 3删除 4查询 5更多方法 3MongoDB可视化工具 4总结   本文原文连接: http://blog.csdn. ...

  8. CentOS7 安装MongoDB 3.0服务

    1,下载&安装 MongoDB 3.0 正式版本发布!这标志着 MongoDB 数据库进入了一个全新的发展阶段,提供强大.灵活而且易于管理的数据库管理系统.MongoDB宣称,3.0新版本不只 ...

  9. CentOS7安装配置redis5.0.5

    一.安装必需包gcc yum install gcc 二.下载redis,并解压 wget http://download.redis.io/releases/redis-5.0.5.tar.gz t ...

随机推荐

  1. C#简单多线程使用(同步和优先权)

    题目: 麦当劳有两个做汉堡的厨师(工号:11,12)和三个销售人员(工号:21,22,23). 厨师生产汉堡,并负责将做好的汉堡放入货架,货架台大小有限,最多放6个汉堡,11和12不能同时往货架台上放 ...

  2. 转自 x_x的百度空间

    空华人生         by 淡漠的心情 昨天,又昨天. 今天,又今天. 明天,又明天. 日历渐渐稀薄,忽然发现,那是时间的痕迹. 似乎,总是在麻木的等待. 何时,才能历尽. 再算算,我又还有多少天 ...

  3. 通过 Azure Media Encoder 降低编码成本

    John Deutscher  Azure 媒体服务首席项目经理 正如在我们的定价页面上宣布的那样,我们引入了一种只根据输出千兆字节数收取编码费用的全新定价模型.之前的/传统模型是根据输入和输出千兆字 ...

  4. StringHelpers

    public class StringHelpers { public const char QUERY_STRING_DELIMITER = '&'; private static Rijn ...

  5. devi into python 笔记(三)callable getattr lambda表达式

    常用的函数:callable():如果所给参数是可调用的,返回True 不可调用返回Fasle.这里指的是否能调用说的是方法.类方法等有doc string的东西,一个单纯的字符串等就不算了. imp ...

  6. log4j的使用方法

    1.Log4j是什么? Log4j可以帮助调试(有时候debug是发挥不了作 用的)和分析 2.Log4j的概念 Log4j中有三个主要的组件,它们分别是 Logger.Appender和Layout ...

  7. vss搭建于操作

    1.下载的vvs2005,下载后先安装在服务器上,反正就是下一步下一步就对了 安装完成后,打开miscrosoft visual sourcesafe,---create  connection da ...

  8. JavaScript高级程序设计31.pdf

    其它方面的变化 DOM的其他部分在“DOM2级核心”中也发生了一些变化,这些变化与XML命名空间无关,而是确保API的可靠性及完整性 DocumentType类型的变化 DocumentType类型新 ...

  9. Poj 3695-Rectangles 矩形切割

    Rectangles Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 3846   Accepted: 1124 Descri ...

  10. 关于list 添加数据到指定下标

    1 2 3 4 5 6 7 8 9 10 11 12 protected <T> List<BusinessItemData> itemMap2ItemList(Map< ...