Nginx(一)初始环境的装置(php5.3+mysql5.1+fastcgi...)51CTO博客 - 凯发娱乐

Nginx(一)初始环境的装置(php5.3+mysql5.1+fastcgi...)51CTO博客

2019年03月29日15时11分53秒 | 作者: 云天 | 标签: 装置,如下,装备 | 浏览: 983

相关参阅资源
http://www.lnmp.org/index.html                         \\LNMP一键装置包
http://www.howtocn.org/nginx                           \\Nginx模块参阅手册中文版
http://blog.s135.com/nginx_php_v6/                      \\张宴写的nginx文章
http://www.nginx.com.cn/                                 \\nginx中文网

如下为我写的。。。。。。

yum -y remove httpd*
yum -y remove mysql*
yum -y remove php*

时刻同步
/usr/sbin/ntpdate 0.rhel.pool.ntp.org > /dev/null 2>&1 ; /sbin/clock -w > /dev/null 2>&1

 yum enablerepo=remi -y install gcc gcc-c++ automake autoconf libtool

 yum -y enablerepo=remi install gd freetype gd-devel.x86_64 freetype.x86_64 \
 freetype-devel.x86_64 libjpeg.x86_64 libjpeg-devel.x86_64  \
 libpng.x86_64 libpng-devel.x86_64 libxml2.x86_64 libxml2-devel.x86_64 \
 zlib.x86_64  zlib-devel.x86_64 libevent.x86_64 libevent-devel.x86_64 \
 bzip2.x86_64 bzip2-devel.x86_64 glib.x86_64 glib-devel.x86_64 glib2.x86_64 glib2-devel.x86_64

 yum enablerepo=remi -y install libc-client.x86_64  libc-client-devel.x86_64

 yum enablerepo=remi -y install net-snmp.x86_64 net-snmp-devel.x86_64 \
 net-snmp-libs.x86_64 net-snmp-utils.x86_64 net-snmp-perl.x86_64

 ln -s /usr/lib64/libpng.so /usr/lib/
 ln -s /usr/lib64/libc-client.a /usr/lib/
 我的是64位体系所以要做这一步


相关软件包的下载,有必要时可到链接处找最新的装置包

mkdir /usr/local/src/lnmp
wget -c http://nginx.org/download/nginx-0.9.1.tar.gz
wget -c http://cn2.php.net/get/php-5.3.3.tar.gz/from/cn.php.net/mirror
wget -c http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.53.tar.gz/from/http://mysql.ntu.edu.tw/
wget -c http://soft.vpser.net/web/pdo/PDO_MYSQL-1.0.2.tgz
wget -c http://pecl.php.net/get/memcache-3.0.5.tgz
wget -c http://soft.vpser.net/web/pcre/pcre-8.10.tar.gz
wget -c http://soft.vpser.net/web/libiconv/libiconv-1.13.tar.gz
wget -c http://soft.vpser.net/web/libmcrypt/libmcrypt-2.5.8.tar.gz
wget -c http://soft.vpser.net/web/mhash/mhash-0.9.9.9.tar.gz
wget -c http://soft.vpser.net/web/mcrypt/mcrypt-2.6.8.tar.gz
wget -c http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2

Install

cd /usr/local/src/lnmp;cur_dir=$(pwd)
cd $cur_dir; tar zxvf libiconv-1.13.tar.gz
cd libiconv-1.13/
./configure prefix=/usr/local
make && make install

cd $cur_dir
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 $cur_dir
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make && make install
cd ../

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
ldconfig

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

Mysql的装置

cd $cur_dir
tar -zxvf mysql-5.1.53.tar.gz
cd mysql-5.1.53/
groupadd mysql
useradd -g mysql mysql
./configure prefix=/usr/local/mysql sysconfdir=/etc \
 with-extra-charsets=all \
 with-charset=utf8 \
 with-plugins=all \
 with-big-tables \
 with-embedded-server \
 enable-local-infile \
 enable-assembler \
 with-mysqld-user=mysql

 #如果报configure: error: No curses/termcap library found
 #yum enablerepo=remi -y install ncurses.x86_64 ncurses-devel.x86_64

make && make install
cd ../
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
chown -R mysql.mysql /usr/local/mysql/
sed -i s/skip-locking/skip-external-locking/g /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db user=mysql
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
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
ldconfig
/etc/init.d/mysql start
/etc/init.d/mysql restart

php+fast-cgi的装置, 5.3.3 源码中开端包括 php-fpm,不必专门再打补丁了,只需要解开源码直接configure,关于php-fpm的编译参数有 –enable-fpm –with-fpm-user=www –with-fpm-group=www –with-libevent-dir=libevent方位。

cd $cur_dir
tar zxvf php-5.3.3.tar.gz
cd php-5.3.3
./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-gd \
with-freetype-dir \
with-jpeg-dir \
with-png-dir \
with-zlib \
with-imap \
with-kerberos \
with-imap-ssl \
with-mhash \
with-mcrypt \
with-curl \
with-curlwrappers \
with-openssl \
with-gettext \
with-iconv-dir \
with-libxml-dir \
enable-fpm \
with-fpm-user=www \
with-fpm-group=www \
with-libevent-dir \
enable-inline-optimization \
enable-mbstring \
enable-ftp \
enable-gd-native-ttf \
enable-zip \
enable-sockets 

#Kerberos libraries not found  ,解决方法是,ln -s /usr/lib64/ /usr/kerberos/lib

make ZEND_EXTRA_LIBS=-liconv
make install
cp php.ini-production /usr/local/php/etc/php.ini
cd ../
ln -s /usr/local/php/bin/php /usr/bin/php
ln -s /usr/local/php/sbin/php-fpm /usr/bin/php-fpm

cd $cur_dir
tar -zxvf memcache-3.0.5.tgz
cd memcache-3.0.5/
/usr/local/php/bin/phpize
./configure with-php-config=/usr/local/php/bin/php-config
make && make install
cd ../

cd $cur_dir
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
mkdir -p /usr/local/eaccelerator_cache
chmod 777 /usr/local/eaccelerator_cache

cd $cur_dir
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 ../

sed -i s/;date.timezone =/date.timezone = Asia\/Shanghai/g /usr/local/php5/etc/php.ini
sed -i s/short_open_tag = Off/short_open_tag = On/g /usr/local/php5/etc/php.ini
sed -i s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g /usr/local/php5/etc/php.ini
sed -i s/upload_max_filesize = 2M/upload_max_filesize = 50M/g /usr/local/php5/etc/php.ini
sed -i 262i output_buffering = On /usr/local/php5/etc/php.ini

#-修正php.ini文件做如下修正-#
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"
extension = "memcache.so"
extension = "pdo_mysql.so"

[eaccelerator]             
;#zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so"
extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/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"

#装备php-fpm.conf,如下操作#
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
vi /usr/local/php/etc/php-fpm.conf

[global]
pid = /usr/local/php5/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
log_level = notice
[www]
listen = 127.0.0.1:9000
user = www
group = www
pm = dynamic
pm.max_children = 2000
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35

groupadd www
useradd -g www www
mkdir -p /var/www/html
chown www.www /var/www/html/

cd $cur_dir
tar zxvf pcre-8.10.tar.gz
cd pcre-8.10/
./configure
make && make install
cd ../

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

 cat >/var/www/html/phpinfo.php<<eof
<?php
phpinfo();
?>
eof


给PHP加快,eAccelerator装备和使用指南
http://www.toplee.com/blog/100.html#pp2    
http://eaccelerator.net/wiki/InstallFromSource         //装置文档
http://eaccelerator.net/wiki/Settings                  //装备阐明

php-fpm办理
kill -SIGINT `cat /usr/local/php/var/run/php-fpm.pid`               //停止
/usr/local/php5/sbin/php-fpm                                       //发动
kill -SIGUSR2 `cat /usr/local/php/var/run/php-fpm.pid`          //重启
kill -SIGUSR1 `cat /usr/local/php/var/run/php-fpm.pid`          //日志

nginx办理
/usr/local/nginx/sbin/nginx                                                       //发动
/usr/local/nginx/sbin/nginx -s reload                                            //滑润重启
/usr/local/nginx/sbin/nginx -t                                                   //测验

Others
nginx0.8.52+php5.3.3
http://addcn.blogbus.com/tag/php5.3.3/

版权声明
本文来源于网络,版权归原作者所有,其内容与观点不代表凯发娱乐立场。转载文章仅为传播更有价值的信息,如采编人员采编有误或者版权原因,请与我们联系,我们核实后立即修改或删除。

猜您喜欢的文章