xml地图|网站地图|网站标签 [设为首页] [加入收藏]

Mysql配置文档,一步一步教你安装Nginx

来源:http://www.ccidsi.com 作者:最新解决方案 人气:188 发布时间:2019-06-26
摘要:日期: Wednesday, May 04, 2011  ver1.0  by doupip 开掘好多VPS用LNMP一键安装包都退步,有无法排错,唯有给出教程,一步一步教你安装,所谓授人于鱼不比授人于渔嘛,本文是在CentOS5.4 操作系统下测试

日期: Wednesday, May 04, 2011  ver1.0  by doupip

开掘好多VPS用LNMP一键安装包都 退步,有无法排错,唯有给出教程,一步一步教你安装,所谓授人于鱼不比授人于渔嘛,本文是在CentOS 5.4 操作系统下测试通过的,用的是DiaHosting上 的三10位系统,为何要用叁13位系统?正是为了节外省存,VPS内部存款和储蓄器都不是累累的,纯32个人系统比X86_X64兼用三11人系统更省里部存款和储蓄器.

Monday, July 23, 2012, ver2.0  by doupip

LNMP安装

设置步骤:

系统供给:Linux 2.6 内核, 本文中的Linux操作系统为CentOS 5.5, 以下操作均以root实践.

参考:

1,晋级系统和装置相关的程序库

参考:

一、获取有关开源程序:

yum -y install yum-fastestmirror
yum -y update
yum -y install patch make gcc gcc-c gcc-g77 flex bison
yum -y install libtool libtool-libs kernel-devel autoconf
yum -y install libjpeg libjpeg-devel libpng libpng-devel
yum -y install freetype freetype-devel libxml2 libxml2-devel zlib  zlib-devel
yum -y install glib2 glib2-devel bzip2 diff*
yum -y install bzip2-devel ncurses ncurses-devel curl curl-devel  e2fsprogs
yum -y install e2fsprogs-devel krb5 krb5-devel libidn libidn-devel
yum -y install openssl openssl-devel vim-minimal
yum -y install fonts-chinese scim-chewing scim-pinyin  scim-tables-chinese

 

1、安装基础包

2,下载相关程序源码包

下载与系统一筹划算

sudo -s
LANG=C
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 libevent-devel

wget
wget
wget
wget
wget
wget
wget
wget
wget
wget
wget  
wget  
wget
wget
wget  
wget

率先,设置系统语言格式, 用系统自带的yum命令安装、进级所需的程序库,蓝字部分:

      

3,早先设置,先安装PHP须求的库程序

LANG=C

2、下载源代码包

tar zxvf libiconv-1.13.1.tar.gz
cd libiconv-1.13.1/
./configure --prefix=/usr/local
make
make install
cd ../

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

wget
wget
wget
wget
wget
wget
wget
wget
wget
wget
wget
wget
wget
wget

tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd

 

 

tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make
make install
cd ../

***************************************************************************************

二、安装PHP 5.2.13(FastCGI模式)

ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config

 

1.         编写翻译安装PHP 5.2.13所需的支撑库:

tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
./configure
make
make install
cd ../

上边列表为相关软件,版本与参考资料中的有个别是不均等的,mysql的下载不包含在内(建议直接download到服务器上,速度很快)

tar zxvf libiconv-1.13.tar.gz
cd libiconv-1.13/
./configure --prefix=/usr/local
make
make install
cd ../

4,安装mysql

推荐介绍用上面包车型客车合法下载地址:

tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd ../../

tar -zxvf mysql-5.1.44.tar.gz
cd mysql-5.1.44
./configure --prefix=/usr/local/mysql --with-extra-charsets=all --enable-thread-safe-client --enable-assembler --with-charset=utf8 --enable-thread-safe-client --with-extra-charsets=all --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --without-debug
make && make install
cd ../

cd    /usr/local/src

tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make
make install
cd ../

开创MySQL数据库,用暗中同意的布署my.cnf

法定下载地址:

ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config

groupadd mysql
useradd -g mysql mysql
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db --user=mysql
chown -R mysql /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql/.

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz    wget "http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?modtime=1171868460&big_mirror=0"    wget "http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz?modtime=1175740843&big_mirror=0"    wget "http://downloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gz?modtime=1194463373&big_mirror=0"    wget http://www.php.net/get/php-5.2.17.tar.gz/from/this/mirror    wget http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz    wget http://pecl.php.net/get/memcache-2.2.5.tgz    wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2    wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz    wget http://blog.s135.com/soft/linux/nginx_php/imagick/ImageMagick.tar.gz    wget http://pecl.php.net/get/imagick-2.3.0.tgz    wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.12.tar.gz    wget http://nginx.org/download/nginx-1.0.1.tar.gz

tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure
make
make install
cd ../

增添Mysql运行服务,并且安装root密码

 

 

cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
chkconfig --level 345 mysql on
echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
echo "/usr/local/lib" >>/etc/ld.so.conf
ldconfig
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
service mysql start
/usr/local/mysql/bin/mysqladmin -u root password root    //root改为您供给的密码
service mysql restart

  

2.         编写翻译安装MySQL 5.5.2-m2

5,安装PHP(FastCGI模式)

下载地址2:

/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
tar zxvf mysql-5.5.2-m2.tar.gz
cd mysql-5.5.2-m2/
./configure --prefix=/usr/local/mysql --enable-assembler --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=partition,innobase,myisammrg
make && make install
chown -R mysql:mysql /usr/local/mysql

tar zxvf php-5.2.13.tar.gz
gzip -cd php-5.2.13-fpm-0.5.13.diff.gz | patch -d php-5.2.13 -p1
cd php-5.2.13/
./buildconf --force
./configure --prefix=/usr/local/php  --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql  --with-mysqli=/usr/local/mysql/bin/mysql_config  --with-iconv-dir=/usr/local --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 --with-curlwrappers --enable-mbregex --enable-fastcgi  --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt  --with-gd --enable-gd-native-ttf --with-mhash --enable-pcntl  --enable-sockets --with-xmlrpc --enable-zip --enable-ftp
make ZEND_EXTRA_LIBS='-liconv'
make install
cp php.ini-dist /usr/local/php/etc/php.ini
cd ../

wget

/usr/local/mysql/bin/mysql_install_db --user=mysql

6,安装PHP增添模块

wget

cp support-files/my-huge.cnf /etc/my.cnf

tar zxvf memcache-2.2.5.tgz
cd memcache-2.2.5/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
cd ../

wget

vi /etc/my.cnf(优化mysql)

tar zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config  --with-pdo-mysql=/usr/local/mysql
make
make install
cd ../

wget

/usr/local/mysql/bin/mysqld_safe --user=mysql &

tar jxvf eaccelerator-0.9.6.tar.bz2
cd eaccelerator-0.9.6/
/usr/local/php/bin/phpize
./configure --enable-eaccelerator=shared  --with-php-config=/usr/local/php/bin/php-config
make
make install
cd ../

wget

mysqladmin -uroot –p password 'password';

设置Zend Optimizer,三十二个人系统版本

wget

delete from user where password=’’;

tar zxvf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
mkdir -p /usr/local/zend/
cp  ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_2_x_comp/ZendOptimizer.so  /usr/local/zend/

wget

cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld

如果是64位系统,则

wget

chkconfig --add mysqld

tar zxvf ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
mkdir -p /usr/local/zend/
cp  ZendOptimizer-3.3.9-linux-glibc23-x86_64/data/5_2_x_comp/ZendOptimizer.so  /usr/local/zend/

wget

chkconfig --level 2345 mysqld on

配置php.ini

wget

 

cat >>/usr/local/php/etc/php.ini<

wget

3.         编写翻译安装PHP(FastCGI形式)

7,修改php.ini文件
手工业修改:查找/usr/local/php/etc/php.ini中的extension_dir = "./"
修改为extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
并在此行后扩大以下几行,然后保留:
extension = "memcache.so"
extension = "pdo_mysql.so"

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.12.tar.gz

tar zxvf php-5.2.13.tar.gz
cd php-5.2.13/

再查找 output_buffering = Off
修改为output_buffering = On

wget

patch -p1 <../php-fpm-0.6~5.2.patch

电动修改:可进行以下shell命令,自动完成对php.ini文件的退换:

 

./buildconf --force

sed -i 's#extension_dir = "./"#extension_dir =  "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"nextension  = "memcache.so"nextension = "pdo_mysql.so"n#'  /usr/local/php/etc/php.ini
sed -i 's#output_buffering = Off#output_buffering = On#'  /usr/local/php/etc/php.ini

**************************************************************************************

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml  --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --with-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --enable-ftp --with-libevent=shared
make ZEND_EXTRA_LIBS='-liconv'
make install
cp php.ini-dist /usr/local/php/etc/php.ini

8,配置eAccelerator加速PHP:
成立缓存目录

 

 

mkdir -p /usr/local/eaccelerator_cache

 一.PHP的安装及相关包安装

本来php5.3.6是时尚牢固版本,但网络海音院信说其代码已受污染,只能改用5.2.17

先安装所需的支持库:

  1. Libiconv     (字符编辑库,转编码用)

1.13.1是前卫版本,libiconv库为索要做转变的选择提供了三个iconv()的函数,以达成八个字符编码到另一个字符编码的改换

       wget

tar zxvf libiconv-1.13.1.tar.gz

cd libiconv-1.13.1/

./configure --prefix=/usr/local

make

make install

cd ../

 

  1. libmcrypt   (加密算法扩充库,用以各个加密码)

Libmcript是暗许安装在/usr/local下的

wget ""

tar zxvf libmcrypt-2.5.8.tar.gz

cd libmcrypt-2.5.8/

./configure

make

make install

cd libltdl

./configure -enable-ltdl-install

make

make install

cd

 

3.  mhash  (哈希函数库,加密及字符串管理用)

wget ""

tar zxvf mhash-0.9.9.9.tar.gz

cd mhash-0.9.9.9/

./configure

make

make install

cd ../

将上述多少个加密库文件都是符号链接的样式指到系统Curry去,以便能够编写翻译时能够向来调用

ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la

ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so

ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4

ln -s /usr/local/lib/libmcrypt.so.4.4.8/usr/lib/libmcrypt.so.4.4.8

ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a

ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la

ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so

ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2

ln -s /usr/local/lib/libmhash.so.2.0.1/usr/lib/libmhash.so.2.0.1

ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config

 

4.  mcrypt     (多个加密库,直接对应php扩展)

mcrypt是八个大致的PHPClass,提供用于拍卖依附mcrypt的加密和平消除密功效

wget ""

tar zxvf mcrypt-2.6.8.tar.gz

cd mcrypt-2.6.8/

LD_LIBRARY_PATH=/usr/local ./configure

make

make install

cd ../

证实: 由于在布署Mcrypt时,会找不到libmcrypt的链接库,导致力不从心编写翻译,

因为Libmcrypt的链接库在/usr/local/文件夹下。因些在配置mcrypt时要参预LD_LIBRARY_PATH=/usr/local导入键接库

下边是上述多个加密库的安装的调用图

 

 

*******************************************************************************

 

以下为mysql下载及安装.因为一连的是其它的中距离服务端晚春布局好的mysql,相关安排这里不讲了,但为了前面包车型地铁配备能顺遂实行,在nginx网址服务器上也亟需张开设置

mysql部分,直接去官方网址注册个账号下载.貌似迅雷会快些,但还要上传至服务器.以下列表为5.5.11-1的版本参谋下载地址  Red Hat版本的  x386 三12个人

可能用wget 选青海的镜像ftp下载异常快下.以为包含服务端,客户端,共享包和支出包. server和client必装.还会有devel和shared包最棒也装上.安装此前先反省类别里是不是有自带的mysql.若是有的话就卸载掉.安装顺序一般server>client>devel>shared

 

wget

wget

wget ftp://ftp.ntu.edu.tw/pub/MySQL/Downloads/MySQL-5.5/MySQL-server-5.5.11-1.rhel5.i386.rpm

wget ftp://ftp.cs.pu.edu.tw/Unix/mysql/Downloads/MySQL-5.5/MySQL-shared-5.5.11-1.rhel5.i386.rpm

rpm -ivh MySQL-server-5.5.11-1.rhel5.i386.rpm

rpm -ivh MySQL-client-5.5.11-1.rhel5.i386.rpm

rpm -ivh MySQL-devel-5.5.11-1.rhel5.i386.rpm

rpm -ivh MySQL-shared-5.5.11-1.rhel5.i386.rpm

 

测试运营:

service mysql start

service mysql stop

或者

/etc/rc.d/init.d/mysql start

/etc/rc.d/init.d/mysql stop

*******************************************************************************

 

  1. 安装php及fpm

查到php最新牢固版是5.3.6(17 March 二零一二),但网络有音信说其代码已经被污染.所以下载了前三个牢固版本5.2.17

php-5.2.17-fpm-0.5.14为其相应的fpm补丁包.   Fpm是三个PHP 法斯特CGI 进程管理器 法斯特CGI是三个可伸缩的,高速地在web server和脚本语言间互动的接口.

php-fpm是为PHP打大巴三个法斯特CGI管理补丁,可以平滑退换php.ini配置而无需重启php-cgi

wget

wget

 

tar zxvf php-5.2.17.tar.gz

打补丁,用上述命令解压覆盖到php-5.2.17文件夹下

gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | patch -d php-5.2.17 -p1  

以下的php配置关联了数不尽库,某些可能用不到.思考到扩大性这里整个涉嫌上, 其它,假设mysql以rpm情势安装,注意其路线(where is mysql)

cd php-5.2.17/

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr --with-mysqli=/usr/bin/mysql_config --with-iconv-dir=/usr/local --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 --with-curlwrappers --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-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap

(make ZEND_EXTRA_LIBS='-liconv' )是编写翻译,make 前边恐怕有其余补丁的,先让后面包车型客车步子走完,然后把此外补丁完的公文下载下来,加上这一个防webshell的修改,上传覆盖,再接着make编写翻译,安装。

make ZEND_EXTRA_LIBS='-liconv'

make install

cp php.ini-dist /usr/local/php/etc/php.ini

cd ../

 

以下装memcache及eaccelerator是为着php加快用的.

  1. memcache  (三个高质量的布满式的内部存款和储蓄器对象缓存系统)

wget

tar zxvf memcache-2.2.5.tgz

cd memcache-2.2.5/

/usr/local/php/bin/phpize

./configure --with-php-config=/usr/local/php/bin/php-config

make

make install

cd ../

 

  1. eaccelerator  eAccelerator是二个私行开放源码php加快器

wget

tar jxvf eaccelerator-0.9.6.1.tar.bz2

cd eaccelerator-0.9.6.1/

/usr/local/php/bin/phpize

./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config

make

make install

cd ../

 

  1. PDO_MYSQL

PDO_MYSQL是PHP Data Objects (PDO) interface的叁个mysql扩张,YII框架也不可能不要用到.

wget

tar zxvf PDO_MYSQL-1.0.2.tgz

cd PDO_MYSQL-1.0.2/

/usr/local/php/bin/phpize

./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/

make

make install

cd ../

 

  1. ImageMagick

一套作用庞大、稳定而且无偿的图像管理及转变的工具集和开荒包

wget

tar zxvf ImageMagick.tar.gz

cd ImageMagick-6.5.1-2/

./configure

make

make install

cd ../

 

  1. imagick同上,也是拓展图形管理的包

wget

tar zxvf imagick-2.3.0.tgz

cd imagick-2.3.0/

/usr/local/php/bin/phpize

./configure --with-php-config=/usr/local/php/bin/php-config

make

make install

cd ../

 

4.         编写翻译安装PHP5扩大模块

配置php.ini

至此,php相关的设置进度停止,以下为有关铺排:

 

11、修改php.ini文件

手工业修改:

查找/usr/local/php/etc/php.ini中的extension_dir = "./"

修改为extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"

抑或将上述路子下的.so文件拷贝进内定的庞大目录下也足以

  并在此行后增添以下几行,然后保留:

  extension = "memcache.so"

  extension = "pdo_mysql.so"

  extension = "imagick.so"

  再查找output_buffering = Off

  修改为output_buffering = On

  再查找; cgi.fix_pathinfo=0

  去掉注释, 修改为cgi.fix_pathinfo=0,防止Nginx文件类型错误分析漏洞。

自行修改(正是用sed作字符替换):

sed -i 's#extension_dir = "./"#extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"nextension = "memcache.so"nextension = "pdo_mysql.so"nextension = "imagick.so"n#' /usr/local/php/etc/php.ini

sed -i 's#output_buffering = Off#output_buffering = On#' /usr/local/php/etc/php.ini

sed -i "s#; always_populate_raw_post_data = On#always_populate_raw_post_data = On#g" /usr/local/php/etc/php.ini

sed -i "s#; cgi.fix_pathinfo=0#cgi.fix_pathinfo=0#g" /usr/local/php/etc/php.ini

 

  1. 配置eAccelerator加速PHP

此地一时看不懂,照做就OK了,

mkdir -p /usr/local/eaccelerator_cache

vi /usr/local/php/etc/php.ini

在结尾加上:

[eaccelerator]

zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"

eaccelerator.shm_size="64"

eaccelerator.cache_dir="/usr/local/eaccelerator_cache"

eaccelerator.enable="1"

eaccelerator.optimizer="1"

eaccelerator.check_mtime="1"

eaccelerator.debug="0"

eaccelerator.filter=""

eaccelerator.shm_max="0"

eaccelerator.shm_ttl="3600"

eaccelerator.shm_prune_period="3600"

eaccelerator.shm_only="0"

eaccelerator.compress="1"

eaccelerator.compress_level="9"

 

  1. 创办一个特地管理网址的用户,如教育

/usr/sbin/groupadd www

/usr/sbin/useradd -g www www

mkdir -p /home/html/foredu

chmod w /home/html/foredu

 

  1. 修改php-fpm配置文件

       重新配置一份php-fpm.conf

mv /usr/local/php/etc/php-fpm.conf /usr/local/php/etc/php-fpm.conf.bak

vi /usr/local/php/etc/php-fpm.conf

剧情如下:

<?xml version="1.0" ?>

<configuration>

  All relative paths in this config are relative to php's install prefix

  <section name="global_options">

    Pid file

    <value name="pid_file">/usr/local/php/logs/php-fpm.pid</value>

    Error log file

    <value name="error_log">/usr/local/php/logs/php-fpm.log</value>

    Log level

    <value name="log_level">notice</value>

    When this amount of php processes exited with SIGSEGV or SIGBUS ...

    <value name="emergency_restart_threshold">10</value>

    ... in a less than this interval of time, a graceful restart will be initiated.

    Useful to work around accidental curruptions in accelerator's shared memory.

    <value name="emergency_restart_interval">1m</value>

    Time limit on waiting child's reaction on signals from master

    <value name="process_control_timeout">5s</value>

    Set to 'no' to debug fpm

    <value name="daemonize">yes</value>

  </section>

  <workers>

    <section name="pool">

      Name of pool. Used in logs and stats.

      <value name="name">default</value>

      Address to accept fastcgi requests on.

      Valid syntax is 'ip.ad.re.ss:port' or just 'port' or '/path/to/unix/socket'

      <value name="listen_address">127.0.0.1:9000</value>

      <value name="listen_options">

        Set listen(2) backlog

        <value name="backlog">-1</value>

        Set permissions for unix socket, if one used.

        In Linux read/write permissions must be set in order to allow connections from web server.

        Many BSD-derrived systems allow connections regardless of permissions.

        <value name="owner"></value>

        <value name="group"></value>

        <value name="mode">0666</value>

      </value>

      Additional php.ini defines, specific to this pool of workers.

      <value name="php_defines">

        <value name="sendmail_path">/usr/sbin/sendmail -t -i</value>

        <value name="display_errors">0</value>

      </value>

      Unix user of processes

      <value name="user">www</value>

      Unix group of processes

      <value name="group">www</value>

      Process manager settings

      <value name="pm">

        Sets style of controling worker process count.

        Valid values are 'static' and 'Apache-like'

        <value name="style">static</value>

        Sets the limit on the number of simultaneous requests that will be served.

        Equivalent to Apache MaxClients directive.

        Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi

        Used with any pm_style.

        <value name="max_children">128</value>

        Settings group for 'apache-like' pm style

        <value name="apache_like">

          Sets the number of server processes created on startup.

          Used only when 'apache-like' pm_style is selected

          <value name="StartServers">20</value>

          Sets the desired minimum number of idle server processes.

          Used only when 'apache-like' pm_style is selected

          <value name="MinSpareServers">5</value>

          Sets the desired maximum number of idle server processes.

          Used only when 'apache-like' pm_style is selected

          <value name="MaxSpareServers">35</value>

        </value>

      </value>

      The timeout (in seconds) for serving a single request after which the worker process will be terminated

      Should be used when 'max_execution_time' ini option does not stop script execution for some reason

      '0s' means 'off'

      <value name="request_terminate_timeout">0s</value>

      The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file

      '0s' means 'off'

      <value name="request_slowlog_timeout">0s</value>

      The log file for slow requests

      <value name="slowlog">logs/slow.log</value>

      Set open file desc rlimit

      <value name="rlimit_files">65535</value>

      Set max core size rlimit

      <value name="rlimit_core">0</value>

      Chroot to this directory at the start, absolute path

      <value name="chroot"></value>

      Chdir to this directory at the start, absolute path

      <value name="chdir"></value>

      Redirect workers' stdout and stderr into main error log.

      If not set, they will be redirected to /dev/null, according to FastCGI specs

      <value name="catch_workers_output">yes</value>

      How much requests each process should execute before respawn.

      Useful to work around memory leaks in 3rd party libraries.

      For endless request processing please specify 0

      Equivalent to PHP_FCGI_MAX_REQUESTS

      <value name="max_requests">1024</value>

      Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect.

      Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2 )

      Makes sense only with AF_INET listening socket.

      <value name="allowed_clients">127.0.0.1</value>

      Pass environment variables like LD_LIBRARY_PATH

      All $VARIABLEs are taken from current environment

      <value name="environment">

        <value name="HOSTNAME">$HOSTNAME</value>

        <value name="PATH">/usr/local/bin:/usr/bin:/bin</value>

        <value name="TMP">/tmp</value>

        <value name="TMPDIR">/tmp</value>

        <value name="TEMP">/tmp</value>

        <value name="OSTYPE">$OSTYPE</value>

        <value name="MACHTYPE">$MACHTYPE</value>

        <value name="MALLOC_CHECK_">2</value>

      </value>

    </section>

  </workers>

</configuration>

假定设置 Nginx PHP 用于程序调节和测试,请将以下的<value name="display_errors">0</value>改为<value name="display_errors">1</value>,以便显示PHP错误新闻,不然,Nginx 会报状态为500的空白错误页,别的, php-cgi进程,监听127.0.0.1的八千端口,进度数为128(假若服务器内部存款和储蓄器小于3GB,可以只开启陆拾一个经过),用户为www, 都以在上述的进展的布署

 

运行命令:

ulimit -SHn 65535
/usr/local/php/sbin/php-fpm start

 

start|stop|quit|restart|reload|logrotate,修改php.ini后不重启php-cgi,重新加载配置文件使用reload

由来,php相关安装及配置完毕.

 

tar zxvf memcache-2.2.5.tgz
cd memcache-2.2.5/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
cd ../

cat >>/usr/local/php/etc/php.ini< <EOF
[eaccelerator]
zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/usr/local/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="3600"
eaccelerator.shm_prune_period="3600"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
EOF

二.Nginx的安装

1、安装nginx所需的pcre库:

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.12.tar.gz

tar zxvf pcre-8.12.tar.gz

cd pcre-8.12/

./configure

make && make install

cd ../

 

  1. 安装nginx

wget

tar zxvf nginx-1.0.1.tar.gz

cd nginx-1.0.1/

./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module

make && make install

cd ../

 

  1. 创造nginx日志目录

mkdir -p /home/logs

chmod w /home/logs

chown -R www:www /home/logs

  1. 修改nginx.conf的文件

mv  /usr/local/nginx/conf/nginx.conf  /usr/local/nginx/conf/nginx.conf.bak

vi /usr/local/nginx/conf/nginx.conf

以下为内容:

user  www www;

worker_processes 8;

error_log  /home/logs/nginx_error.log  crit;

pid        /usr/local/nginx/nginx.pid;

#Specifies the value for maximum file descriptors that can be opened by this process.

worker_rlimit_nofile 65535;

events

{

  use epoll;

  worker_connections 65535;

}

http

{

  include       mime.types;

  default_type  application/octet-stream;

  #charset  gb2312;

     

  server_names_hash_bucket_size 128;

  client_header_buffer_size 32k;

  large_client_header_buffers 4 32k;

  client_max_body_size 8m;

     

  sendfile on;

  tcp_nopush     on;

  keepalive_timeout 60;

  tcp_nodelay on;

 

  fastcgi_connect_timeout 300;

  fastcgi_send_timeout 300;

  fastcgi_read_timeout 300;

  fastcgi_buffer_size 64k;

  fastcgi_buffers 4 64k;

  fastcgi_busy_buffers_size 128k;

  fastcgi_temp_file_write_size 128k;

 

  gzip on;

  gzip_min_length  1k;

  gzip_buffers     4 16k;

  gzip_http_version 1.0;

  gzip_comp_level 2;

  gzip_types       text/plain application/x-javascript text/css application/xml;

  gzip_vary on;

  #limit_zone  crawler  $binary_remote_addr  10m;

  server

  {

    listen       80;

    server_name  www.2277.com;

    index index.html index.htm index.php;

    root  /home/html/foredu/test;

 

    #limit_conn   crawler  20;   

                            

    location ~ .*.(php|php5)?$

    {     

      #fastcgi_pass  unix:/tmp/php-cgi.sock;

      fastcgi_pass  127.0.0.1:9000;

      fastcgi_index index.php;

      include fcgi.conf;

    }

   

    location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$

    {

      expires      30d;

    }

 

    location ~ .*.(js|css)?$

    {

      expires      1h;

    }   

 

    log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '

              '$status $body_bytes_sent "$http_referer" '

              '"$http_user_agent" $http_x_forwarded_for';

    access_log  /home/logs/access.log  access;

      }

#以下两段尚未什么用场

  server

  {

    listen       80;

    server_name  www.2277.com;

    index index.html index.htm index.php;

    root  /data0/htdocs/www;

 

    location ~ .*.(php|php5)?$

    {     

      #fastcgi_pass  unix:/tmp/php-cgi.sock;

      fastcgi_pass  127.0.0.1:9000;

      fastcgi_index index.php;

      include fcgi.conf;

    }

 

    log_format  wwwlogs  '$remote_addr - $remote_user [$time_local] "$request" '

               '$status $body_bytes_sent "$http_referer" '

               '"$http_user_agent" $http_x_forwarded_for';

    access_log  /home/logs/wwwlogs.log  wwwlogs;

  }

 

  server

  {

    listen  80;

    server_name  status.2277.com;

 

    location / {

    stub_status on;

    access_log   off;

    }

  }

}

 

  1. 在/usr/local/nginx/conf/目录中开创fcgi.conf文件:

vi /usr/local/nginx/conf/fcgi.conf

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;

fastcgi_param  SERVER_SOFTWARE    nginx;

 

fastcgi_param  QUERY_STRING       $query_string;

fastcgi_param  REQUEST_METHOD     $request_method;

fastcgi_param  CONTENT_TYPE       $content_type;

fastcgi_param  CONTENT_LENGTH     $content_length;

 

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;

fastcgi_param  REQUEST_URI        $request_uri;

fastcgi_param  DOCUMENT_URI       $document_uri;

fastcgi_param  DOCUMENT_ROOT      $document_root;

fastcgi_param  SERVER_PROTOCOL    $server_protocol;

 

fastcgi_param  REMOTE_ADDR        $remote_addr;

fastcgi_param  REMOTE_PORT        $remote_port;

fastcgi_param  SERVER_ADDR        $server_addr;

fastcgi_param  SERVER_PORT        $server_port;

fastcgi_param  SERVER_NAME        $server_name;

 

# PHP only, required if PHP was built with --enable-force-cgi-redirect

fastcgi_param  REDIRECT_STATUS    200;

 

启动Nginx

ulimit -SHn 65535

/usr/local/nginx/sbin/nginx

 

tar jxvf eaccelerator-0.9.6.tar.bz2
cd eaccelerator-0.9.6/
/usr/local/php/bin/phpize
./configure       --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config
make
make install
cd ../

9,创制www用户和组,以及主机要求的目录,日志目录

三.YII框架

 

  1. 将YII框架代码及写好的test文件代码打包上传至/home/html/foredu下

    2. 确认nginx.conf中的域名及文件夹地方正确.如有修改则重启相关服务

    3. test代码文书中,以下文件夹权限设置为777(那其间都会变卦文书)

upload

assets

protected/runtime

protected/manager/runtime

js/kindeditor/attached 此目录恐怕需求手工业建

  1. 修改protected/config/db.php中的数据库的布局项

  2. 测试张开test页面

 

tar zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
make
make install
cd ../

groupadd www
useradd -g www www
mkdir -p /home/www
chmod w /home/www
mkdir -p /home/www/logs
chmod 777 /home/www/logs
chown -R www:www /home/www

四. 其余优化项

安排到以上就可以.

以下为系统优化项,也能够略过****************************************************************

  1. 万一是加到开机运营项中:

       ulimit -SHn 65535

/usr/local/php/sbin/php-fpm start

/usr/local/nginx/sbin/nginx

 

2.优化linux内核参数

vi /etc/sysctl.conf

最终增添:

       # Add

net.ipv4.tcp_max_syn_backlog = 65536

net.core.netdev_max_backlog =  32768

net.core.somaxconn = 32768

 

net.core.wmem_default = 8388608

net.core.rmem_default = 8388608

net.core.rmem_max = 16777216

net.core.wmem_max = 16777216

 

net.ipv4.tcp_timestamps = 0

net.ipv4.tcp_synack_retries = 2

net.ipv4.tcp_syn_retries = 2

 

net.ipv4.tcp_tw_recycle = 1

#net.ipv4.tcp_tw_len = 1

net.ipv4.tcp_tw_reuse = 1

 

net.ipv4.tcp_mem = 94500000 915000000 927000000

net.ipv4.tcp_max_orphans = 3276800

 

#net.ipv4.tcp_fin_timeout = 30

#net.ipv4.tcp_keepalive_time = 120

net.ipv4.ip_local_port_range = 1024  65535

 

使配置生效: /sbin/sysctl –p

 

  1. 测试及平滑退换nginx配置

       每趟修改nginx.conf后,能够用以下命令测试语法是或不是精确:

       /usr/local/nginx/sbin/nginx –t

       OK的话荧屏显示以下两行音讯,表达配置文件精确:

  the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok

  the configuration file /usr/local/nginx/conf/nginx.conf was tested successfully

平整重启:

/usr/local/nginx/sbin/nginx –s reload

定时切割日志:

vi /usr/local/nginx/sbin/cut_nginx_log.sh

内容如下:

        # This script run at 00:00

# The Nginx logs path

logs_path="/usr/local/nginx/logs/"

 

mkdir -p ${logs_path}$(date -d "yesterday" "%Y")/$(date -d "yesterday" "%m")/

mv ${logs_path}access.log ${logs_path}$(date -d "yesterday" "%Y")/$(date -d "yesterday" "%m")/access_$(date -d "yesterday" "%Y%m%d").log

kill -USR1 `cat /usr/local/nginx/nginx.pid`

 

crontab –e

00 00 * * * /bin/bash  /usr/local/nginx/sbin/cut_nginx_log.sh

********************************************************************************

全文完..


tar zxvf ImageMagick.tar.gz
cd ImageMagick-6.5.1-2/
./configure
make
make install
cd ../

10,创设php-fpm配置文件

tar zxvf imagick-2.3.0.tgz
cd imagick-2.3.0/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
cd ../

rm -f /usr/local/php/etc/php-fpm.conf
vi /usr/local/php/etc/php-fpm.conf

             

输入以下内容,笔者设置开的进程是5个.要求更加精雕细琢程数,能够修改5

5.         修改php.ini文件

<configuration>
  All relative paths in this config are relative to php's install prefix  
  <section name="global_options">
    Pid file  
    <value name="pid_file">/usr/local/php/logs/php-fpm.pid</value>
    Error log file  
    <value name="error_log">/usr/local/php/logs/php-fpm.log</value>
    Log level  
    <value name="log_level">notice</value>
    When this amount of php processes exited with SIGSEGV or SIGBUS ...  
    <value name="emergency_restart_threshold">10</value>
    ... in a less than this interval of time, a graceful restart will be initiated.  
    Useful to work around accidental curruptions in accelerator's shared memory.  
    <value name="emergency_restart_interval">1m</value>
    Time limit on waiting child's reaction on signals from master  
    <value name="process_control_timeout">5s</value>
    Set to 'no' to debug fpm  
    <value name="daemonize">yes</value>
  </section>
  <workers>
    <section name="pool">
      Name of pool. Used in logs and stats.  
      <value name="name">default</value>
      Address to accept fastcgi requests on.  
      Valid syntax is 'ip.ad.re.ss:port' or just 'port' or '/path/to/unix/socket'  
      <value name="listen_address">/tmp/php-cgi.sock</value>
      <value name="listen_options">
        Set listen(2) backlog  
        </value><value name="backlog">-1</value>
        Set permissions for unix socket, if one used.  
        In Linux read/write permissions must be set in order to allow connections from web server.  
        Many BSD-derrived systems allow connections regardless of permissions.  
        <value name="owner"></value>
        <value name="group"></value>
        <value name="mode">0666</value>
     
      Additional php.ini defines, specific to this pool of workers.  
      <value name="php_defines">
        </value><value name="sendmail_path">/usr/sbin/sendmail -t -i</value>
        <value name="display_errors">1</value>
     
      Unix user of processes  
        <value name="user">www</value>
      Unix group of processes  
        <value name="group">www</value>
      Process manager settings  
      <value name="pm">
        Sets style of controling worker process count.  
        Valid values are 'static' and 'Apache-like'  
        </value><value name="style">static</value>
        Sets the limit on the number of simultaneous requests that will be served.  
        Equivalent to Apache MaxClients directive.  
        Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi  
        Used with any pm_style.  
        <value name="max_children">5</value>
        Settings group for 'apache-like' pm style  
        <value name="apache_like">
          Sets the number of server processes created on startup.  
          Used only when 'apache-like' pm_style is selected  
          </value><value name="StartServers">20</value>
          Sets the desired minimum number of idle server processes.  
          Used only when 'apache-like' pm_style is selected  
          <value name="MinSpareServers">5</value>
          Sets the desired maximum number of idle server processes.  
          Used only when 'apache-like' pm_style is selected  
          <value name="MaxSpareServers">35</value>
       
     
      The timeout (in seconds) for serving a single request after which the worker process will be terminated  
      Should be used when 'max_execution_time' ini option does not stop script execution for some reason  
      '0s' means 'off'  
      <value name="request_terminate_timeout">0s</value>
      The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file  
      '0s' means 'off'  
      <value name="request_slowlog_timeout">0s</value>
      The log file for slow requests  
      <value name="slowlog">logs/slow.log</value>
      Set open file desc rlimit  
      <value name="rlimit_files">51200</value>
      Set max core size rlimit  
      <value name="rlimit_core">0</value>
      Chroot to this directory at the start, absolute path  
      <value name="chroot"></value>
      Chdir to this directory at the start, absolute path  
      <value name="chdir"></value>
      Redirect workers' stdout and stderr into main error log.  
      If not set, they will be redirected to /dev/null, according to FastCGI specs  
      <value name="catch_workers_output">yes</value>
      How much requests each process should execute before respawn.  
      Useful to work around memory leaks in 3rd party libraries.  
      For endless request processing please specify 0  
      Equivalent to PHP_FCGI_MAX_REQUESTS  
      <value name="max_requests">10240</value>
      Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect.  
      Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2 )  
      Makes sense only with AF_INET listening socket.  
      <value name="allowed_clients">127.0.0.1</value>
      Pass environment variables like LD_LIBRARY_PATH  
      All $VARIABLEs are taken from current environment  
      <value name="environment">
        </value><value name="HOSTNAME">$HOSTNAME</value>
        <value name="PATH">/usr/local/bin:/usr/bin:/bin</value>
        <value name="TMP">/tmp</value>
        <value name="TMPDIR">/tmp</value>
        <value name="TEMP">/tmp</value>
        <value name="OSTYPE">$OSTYPE</value>
        <value name="MACHTYPE">$MACHTYPE</value>
        <value name="MALLOC_CHECK_">2</value>
     
    </section>
  </workers>
</configuration>

       手工业修改:查找/usr/local/php/etc/php.ini中的 extension_dir = "./"修改为extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
  并在此行后扩大以下几行,然后保留:
extension = "memcache.so"
extension = "pdo_mysql.so"
extension = "imagick.so"

11,运维php-cgi进度,监听127.0.0.1的八千端口,进度数为5,用户为www

  再查找 output_buffering = Off
  修改为output_buffering = On

ulimit -SHn 65535
/usr/local/php/sbin/php-fpm start

 

注:/usr/local/php/sbin/php-fpm还应该有别的参数,包涵:start|stop|quit|restart|reload|logrotate,修改php.ini后不重启php-cgi,重新加载配置文件 使用reload

配置eAccelerator加速PHP:

12,安装Nginx

mkdir -p /usr/local/eaccelerator_cache
vi /usr/local/php/etc/php.ini

tar zxvf pcre-8.01.tar.gz
cd pcre-8.01/
./configure
make && make install
cd ../

            按shift g键跳到安顿文件的最末尾,加上以下 配置音讯:

tar zxvf nginx-0.7.65.tar.gz
cd nginx-0.7.65/
./configure --user=www --group=www --prefix=/usr/local/nginx  --with-http_stub_status_module --with-http_ssl_module  --with-http_gzip_static_module
make && make install
cd ../

[eaccelerator]
zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="64"
eaccelerator.cache_dir="/usr/local/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="3600"
eaccelerator.shm_prune_period="3600"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

13,创立Nginx配置文件

 

mkdir -p /usr/local/nginx/conf/servers
rm -f /usr/local/nginx/conf/nginx.conf
vi /usr/local/nginx/conf/nginx.conf

6.         成立www用户和组,以及供www.carl.com虚拟主机使用的目录:

输入以下内容:

/usr/sbin/groupadd www
/usr/sbin/useradd -g www www
mkdir -p /data0/htdocs/blog
chmod w /data0/htdocs/blog
chown -R www:www /data0/htdocs/blog

user  www www;
worker_processes 1;
error_log  /home/www/logs/nginx_error.log  crit;
pid        /usr/local/nginx/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by  this process.
worker_rlimit_nofile 65535;
events
{
use epoll;
worker_connections 65535;
}
http
{
include       mime.types;
default_type  application/octet-stream;
#charse  gb2312;
server_names_hash_bucket_size 128;
client_header_buffer_size 128k;
large_client_header_buffers 4 256k;
client_max_body_size 8m;
sendfile on;
tcp_nopush     on;
keepalive_timeout 60;
tcp_nodelay on;

 

fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;

7.         创设php-fpm配置文件(php-fpm是为PHP打客车三个法斯特CGI管理补丁,能够平滑改造php.ini配置而不供给重启php- cgi):

gzip on;
gzip_min_length  1k;
gzip_buffers     4 16k;
gzip_http_version 1.1;
gzip_comp_level 9;
gzip_types       text/plain application/x-javascript text/css  application/xml;
gzip_vary on;
output_buffers   4 32k;
postpone_output  1460;

       在/usr/local/php/etc/目录中开创php-fpm.conf文件:

#limit_zone  crawler  $binary_remote_addr  10m;

rm -f /usr/local/php/etc/php-fpm.conf
vi /usr/local/php/etc/php-fpm.conf

server
{
listen       80;
server_name vps.imcat.in;
index index.html index.htm index.php;
include location.conf;
root  /home/www;
}
include servers/*;
}

 

14,在/usr/local/nginx/conf/目录中开创location.conf文件:

输入以下内容(即使您安装 Nginx PHP 用于程序调节和测试,请将以下的<value name="display_errors">0</value>改为<value name="display_errors">1</value>,以便显示PHP错误新闻,不然,Nginx 会报状态为500的空域错误页):

vi /usr/local/nginx/conf/location.conf

 

输入内容:

<?xml version="1.0" ?>
<configuration>

location ~ .*.(php|php5)?$
{
#fastcgi_pass  unix:/tmp/php-cgi.sock;
fastcgi_pass  127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}

  All relative paths in this config are relative to php's install prefix

location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
{
expires      30d;
}

  <section name="global_options">

location ~ .*.(js|css)?$
{
expires      12h;
}

本文由68399皇家赌场发布于最新解决方案,转载请注明出处:Mysql配置文档,一步一步教你安装Nginx

关键词: 68399皇家赌场

上一篇:切换菜单实例,bootstrap源码学习与示例

下一篇:没有了

最火资讯