Nginx + PHP+ MySQL在centos下的安装

社区服务
高级搜索
猴岛论坛电脑百科Nginx + PHP+ MySQL在centos下的安装
发帖 回复
正序阅读 最近浏览的帖子最近浏览的版块
4个回复

[技术小组]Nginx + PHP+ MySQL在centos下的安装

楼层直达
   三岁

ZxID:44344

糖果

举报 只看楼主 使用道具 楼主   发表于: 2014-12-02 0
— 本帖被 - 不懂浪漫゛ 执行加亮操作(2014-12-02) —
配置了1台Web服务器,将安装笔记贴出来
1、安装Nginx:
  1. mkdir -p /Data/tgz
  2. cd /Data/tgz
  3. yum install wget
  4. yum install pcre
  5. yum install openssl*
  6. yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers make
  7. yum -y install gd gd2 gd-devel gd2-devel
  8. /usr/sbin/groupadd www
  9. /usr/sbin/useradd -g www www
  10. ulimit -SHn 65535
  11. wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.32.tar.gz
  12. tar zxvf pcre-8.32.tar.gz
  13. cd pcre-8.32
  14. ./configure --prefix=/Data/apps/pcre
  15. make && make install
  16. cd ../
  17. wget http://nginx.org/download/nginx-1.5.2.tar.gz
  18. tar zxvf nginx-1.5.2.tar.gz
  19. cd nginx-1.5.2
  20. ./configure --user=www --group=www --prefix=/Data/apps/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/Data/tgz/pcre-8.32 --with-http_realip_module --with-http_image_filter_module
  21. make
  22. make install


2、安装 MySQL:
  1. wget http://downloads.mysql.com/archives/mysql-5.6/mysql-5.6.10-linux-glibc2.5-x86_64.tar.gz
  2. tar zxvf mysql-5.6.10-linux-glibc2.5-x86_64.tar.gz
  3. mv mysql-5.6.10-linux-glibc2.5-x86_64 /Data/apps/mysql
  4. /usr/sbin/groupadd mysql
  5. /usr/sbin/useradd -g mysql mysql
  6. mkdir -p /Data/data/mysql/data
  7. yum install libaio
  8. /Data/apps/mysql/scripts/mysql_install_db --basedir=/Data/apps/mysql --datadir=/Data/data/mysql/data --user=mysql
  9. sed -i "s#/usr/local/mysql#/Data/apps/mysql#g" /Data/apps/mysql/bin/mysqld_safe


3、安装PHP依赖库
  1. mkdir -p /Data/apps/libs/
  2. wget http://www.ijg.org/files/jpegsrc.v9.tar.gz
  3. tar zxvf jpegsrc.v9.tar.gz
  4. cd jpeg-9/
  5. ./configure --prefix=/Data/apps/libs --enable-shared --enable-static --prefix=/Data/apps/libs
  6. make
  7. make install
  8. cd ../
  9. wget http://prdownloads.sourceforge.net/libpng/libpng-1.6.2.tar.gz
  10. tar zxvf libpng-1.6.2.tar.gz
  11. cd libpng-1.6.2/
  12. ./configure --prefix=/Data/apps/libs
  13. make
  14. make install
  15. cd ../
  16. wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.12.tar.gz
  17. tar zxvf freetype-2.4.12.tar.gz
  18. cd freetype-2.4.12/
  19. ./configure --prefix=/Data/apps/libs
  20. make
  21. make install
  22. cd ../
  23. wget "http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz?big_mirror=0"
  24. wget "http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?big_mirror=0"
  25. wget "http://downloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gz?big_mirror=0"
  26. tar zxvf libmcrypt-2.5.8.tar.gz
  27. cd libmcrypt-2.5.8/
  28. ./configure --prefix=/Data/apps/libs
  29. make
  30. make install
  31. cd libltdl/
  32. ./configure --prefix=/Data/apps/libs --enable-ltdl-install
  33. make
  34. make install
  35. cd ../../
  36. tar zxvf mhash-0.9.9.9.tar.gz
  37. cd mhash-0.9.9.9/
  38. ./configure --prefix=/Data/apps/libs
  39. make
  40. make install
  41. cd ../


然后
  1. vi /etc/ld.so.conf


添加:
  1. /Data/apps/libs/lib


最后:

  1. ldconfig
  2.   
  3. tar zxvf mcrypt-2.6.8.tar.gz
  4. cd mcrypt-2.6.8/
  5. export LDFLAGS="-L/Data/apps/libs/lib -L/usr/lib"
  6. export CFLAGS="-I/Data/apps/libs/include -I/usr/include"
  7. touch malloc.h
  8. ./configure --prefix=/Data/apps/libs --with-libmcrypt-prefix=/Data/apps/libs
  9. make
  10. make install
  11. cd ../

4、编译安装PHP
  1. wget [url]http://www.php.net/get/php-5.5.1.tar.gz/from/tw2.php.net/mirror[/url]
  2. tar zxvf php-5.5.1.tar.gz
  3. cd php-5.5.1/
  4. export LIBS="-lm -ltermcap -lresolv"
  5. export DYLD_LIBRARY_PATH="/Data/apps/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64"
  6. export LD_LIBRARY_PATH="/Data/apps/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64"
  7. ./configure --prefix=/Data/apps/php --with-config-file-path=/Data/apps/php/etc --with-mysql=/Data/apps/mysql --with-mysqli=/Data/apps/mysql/bin/mysql_config --with-iconv-dir --with-freetype-dir=/Data/apps/libs --with-jpeg-dir=/Data/apps/libs --with-png-dir=/Data/apps/libs --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt=/Data/apps/libs --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-opcache --with-pdo-mysql --enable-maintainer-zts
  8. make
  9. make install
  10. cp php.ini-development /Data/apps/php/etc/php.ini
  11. cd ../
  12. ln -s /Data/apps/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
  13. mv /Data/apps/php/etc/php-fpm.conf.default /Data/apps/php/etc/php-fpm.conf


5、编译安装PHP扩展
  1. wget http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
  2. tar zxvf autoconf-latest.tar.gz
  3. cd autoconf-2.69/
  4. ./configure --prefix=/Data/apps/libs
  5. make
  6. make install
  7. cd ../
  8. wget http://pecl.php.net/get/memcache-2.2.7.tgz
  9. tar zxvf memcache-2.2.7.tgz
  10. cd memcache-2.2.7/
  11. export PHP_AUTOCONF="/Data/apps/libs/bin/autoconf"
  12. export PHP_AUTOHEADER="/Data/apps/libs/bin/autoheader"
  13. /Data/apps/php/bin/phpize
  14. ./configure --with-php-config=/Data/apps/php/bin/php-config
  15. make
  16. make install
  17. cd ../


结束:
  1. 打开 /Data/apps/php/etc/php.ini 查找 ; extension_dir = "ext"
  2.   在其后增加一行:
  3. extension = "memcache.so"



安装版本:
  1. Nginx 1.5.2
  2. PHP 5.5.1
  3. MySQL 5.6.10
  1. 这只是一个笔记而已~!
  2. - -~!

本帖de评分: 2 条评分 DB +250
DB+200 2014-12-30

单机区感谢你的付出

DB+50 2014-12-02

๓电脑技术有你更精彩๑

[/url]
猴岛论坛技术组-神一般的头衔 各个领域 天才云集 福利多多 你还在等什么 赶快加入我们吧!

小野博客
Soldier13d070

ZxID:55772095

等级: 上尉
举报 只看该作者 4楼  发表于: 2014-12-07 0
看不懂
胡大大丶

ZxID:110100

等级: 准尉
【     时光会教你看清每一个人的脸.  】
举报 只看该作者 地板   发表于: 2014-12-02 0
弱弱的问一句这是什么东东~~
- 不懂浪漫゛

ZxID:16584776

等级: 元老

举报 只看该作者 板凳   发表于: 2014-12-02 0
不错 可以帮助小白了解一下
但是我觉得小白也看不懂这个代码了...
引用
« 返回列表
发帖 回复