首页 > 代码库 > centOS 部署服务器(二)

centOS 部署服务器(二)

(1)安装nginx

  1.下载地址: http://nginx.org/en/download.html ,并解压到目录下

  2.安装依赖包 yum -y install pcre*  yum -y install openssl*

  3.执行./configure --prefix=/usr/local/nginx

               编译make,make install(如果是非root用户 make 和sudo make install 分开 同理,其他的安装包也是这样)
  4. 建立软链接:# ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/
  5. 进入/usr/local/nginx/conf目录,建立虚拟主机配置目录,并将此目录导入到nginx.conf中

  # mkdir vhost

  # vim ./nginx.conf (在最后大括号前添加一行并保存退出: include vhost/*.conf; )

  6. 可在vhost目录内新建虚拟主机配置文件,以.conf结尾,内容可参考nginx.conf中的server部分

(2)安装php:

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

  2.安装依赖包 :yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel

  3. 由于centOS没有libmcrypt,所以要先下载第三方源

          wget http://www.atomicorp.com/installers/atomic
          sh ./atomic
     yum install php-mcrypt libmcrypt-devel
  4.  ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysqli --with-iconv --with-freetype-dir --with-jpeg-dir --with-     png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop     --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-      mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip      --enable-soap --without-pear --with-zlib --enable-pdo --with-pdo-mysql --enable-opcache
  5. 进入到php安装目录下:
    
    cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
    cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
    修改www.conf 下面user=wwww,group=www
    最后ps -aux | grep php-fpm就可以启动了
    
    技术分享
(3)安装composer
    curl -sS https://getcomposer.org/installer | php
      执行这个命令前要建立php的软连接,ln -s /usr/local/php/bin/php /usr/local/bin
       mv composer.phar /usr/local/bin/composer
(4)安装redis
 

centOS 部署服务器(二)