您好,欢迎来到榕意旅游网。
搜索
您的当前位置:首页Nginx(一)初始环境的安装(php5.3+mysql5.1+fastcgi...)

Nginx(一)初始环境的安装(php5.3+mysql5.1+fastcgi...)

来源:榕意旅游网
相关参考资源

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_ freetype.x86_ \\ freetype-devel.x86_ libjpeg.x86_ libjpeg-devel.x86_ \\

libpng.x86_ libpng-devel.x86_ libxml2.x86_ libxml2-devel.x86_ \\ zlib.x86_ zlib-devel.x86_ libevent.x86_ libevent-devel.x86_ \\ bzip2.x86_ bzip2-devel.x86_ glib.x86_ glib-devel.x86_ glib2.x86_ glib2-devel.x86_

yum --enablerepo=remi -y install libc-client.x86_ libc-client-devel.x86_ yum --enablerepo=remi -y install net-snmp.x86_ net-snmp-devel.x86_ \\ net-snmp-libs.x86_ net-snmp-utils.x86_ net-snmp-perl.x86_ ln -s /usr/lib/libpng.so /usr/lib/ ln -s /usr/lib/libc-client.a /usr/lib/ 我的是位系统所以要做这一步

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

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_ ncurses-devel.x86_ 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/lib/ /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=\"\"

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加速,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/

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- nryq.cn 版权所有 赣ICP备2024042798号-6

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务