34r2312 发表于 2015-1-15 08:57:46

linux下基于电商平台lnmp部署

实验环境:
system:centos 6.5
nginx:tengine-1.5.1
php:php-5.4.25
mysql:mysql-5.5.38

# yum install -y make cmake apr* autoconf automake curl-devel gcc gcc-c++ gtk+-develzlib-devel openssl openssl-devel pcre-devel gd gd-develgettext gettext-devel kernel keyutilspatchperl kernel-headers compat* mpfr cpp glibc libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel zlib-devel libXpm* freetype freetype-devel freetype* fontconfig fontconfig-devel libjpeg* libpng* php-common php-gd ncurses* libtool* libxml2 libxml2-devel patch libxslt-devel lua-devel GeoIP GeoIP-devel t1lib-devel libicu-devel libmcrypt-devel
# ln -s /usr/lib64/* /usr/lib/

1.nginx 安装
# tar zxf pcre-8.34.tar.gz
# cd pcre-8.34
# ./configure
# make && make install
# useradd nginx -s /sbin/nologin
# tar zxf tengine-1.5.1.tar.gz
# cd tengine-1.5.1
# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_sysguard_module --with-http_concat_module --enable-mods-shared=all
# make && make install
# ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx
# mv /opt/nginxd /etc/init.d/   # nginxd启动脚本在附件
# chmod 700 /etc/init.d/nginxd
# chkconfig --add nginxd
# chkconfig nginxd on

2.php安装
# tar zxf php-5.4.25.tar.gz
# cd php-5.4.25
# ./configure--prefix=/usr/local/php --sysconfdir=/usr/local/php/etc --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --disable-cgi --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/etc/ext --enable-calendar --with-curl --enable-ftp --with-gd --enable-intl --enable-mbstring --with-mcrypt --with-mysql --with-pdo-mysql --enable-sockets --enable-zip --with-pcre-dir --enable-mysqlnd --with-iconv=/usr/local/libiconv --with-jpeg-dir=DIR --with-png-dir=DIR --with-zlib-dir=DIR --with-xpm-dir=DIR --with-freetype-dir=DIR --with-t1lib=DIR --enable-gd-native-ttf --enable-gd-jis-conv --with-iconv
# make && make install
# cp php.ini-production /usr/local/php/etc/php.ini
# rm -rf /etc/php.ini
# ln -s /usr/local/php/etc/php.ini/etc/php.ini
# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
# chmod o+x /etc/rc.d/init.d/php-fpm
# chkconfig --add php-fpm
# chkconfig php-fpm on

3.mysql安装
# useradd mysql -s /sbin/nologin
# tar zxf mysql-5.5.38.tar.gz
# cd mysql-5.5.38
# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/var/lib/mysql -DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DWITH_SSL=system -DWITH_DEBUG=0
# make && make install
# mkdir /var/lib/mysql
# mkdir /var/log/mysql
# chown -R mysql:mysql /var/lib/mysql
# chown -R mysql:mysql /var/log/mysql
# /usr/local/mysql/scripts/mysql_install_db --user=mysql --pid-file=/var/lib/mysql/mysql.pid --datadir=/var/lib/mysql/ --basedir=/usr/local/mysql
# cp support-files/my-medium.cnf /etc/my.cnf
# vi /etc/my.cnf

socket          = /var/lib/mysql/mysql.sock
# The MySQL server

socket          = /var/lib/mysql/mysql.sock
log-error = /var/log/mysql/mysql-error.log
pid-file = /var/lib/mysql/mysql.pid
character-set-server = utf8
# cp support-files/mysql.server /etc/rc.d/init.d/mysql
# chmod o+x /etc/rc.d/init.d/mysql
# chkconfig --add mysql
# chkconfig mysql on
# ln /usr/local/mysql/bin/mysql /usr/bin/
# ln /usr/local/mysql/bin/mysqladmin /usr/bin/
# ln /usr/local/mysql/bin/mysqldump /usr/bin/

4.php插件安装
(1)apc
# tar zxf APC-3.1.13.tgz
# cd APC-3.1.13
# /usr/local/php/bin/phpize
# ./configure --with-php-config=/usr/local/php/bin/php-config --enable-apc --enable-mmap --enable-apc-spinlocks --disable-apc-pthreadmutex
# make && make install
# echo "extension = apc.so" >> /usr/local/webapps/php/etc/php.ini
(2)memcache
# tar zxf memcache-2.2.7.tgz
# cd memcache-2.2.7
# /usr/local/php/bin/phpize
# ./configure--with-php-config=/usr/local/php/bin/php-config
# make && make install
# echo "extension = memcache.so" >> /usr/local/php/etc/php.ini
(3)redis
# unzip phpredis-master.zip
# cd phpredis-master
# /usr/local/php/bin/phpize
# ./configure --with-php-config=/usr/local/php/bin/php-config
# make && make install
# echo "extension = redis.so" >> /usr/local/php/etc/php.ini
(4)imagick
# tar zxf ImageMagick.tar.gz
# cd ImageMagick-6.8.9-10/
# ./configure LDFLAGS="-L/usr/lib" CPPFLAGS="-I/usr/include" --prefix=/usr/local/ImageMagick --enable-shared --enable-lzw --disable-openmp
# tar zxf imagick-3.1.0RC2.tgz
# cd imagick-3.1.0RC2
# /usr/local/php/bin/phpize
# ln -s /usr/local/ImageMagick/include/ImageMagick-6 /usr/local/ImageMagick/include/ImageMagick
# ./configure --with-php-config=/usr/local/php/bin/php-config --with-imagick=/usr/local/ImageMagick/
/php-config --with-imagick=/usr/local/ImageMagick/
# make && make install
# echo "extension = imagick.so" >> /usr/local/php/etc/php.ini
(5)magickwand
# tar zxf MagickWandForPHP-1.0.9-2.tar.gz
# cd MagickWandForPHP-1.0.9
# /usr/local/php/bin/phpize
# ./configure --prefix=/usr/local/magickwand --enable-shared --with-php-config=/usr/local/php/bin/php-config --with-magickwand=/usr/local/ImageMagick/
# make && make install
# echo "extension = magickwand.so" >> /usr/local/php/etc/php.ini
(6)eaccelerator
# tar zxfeaccelerator-eaccelerator-42067ac.tar.gz
# cd eaccelerator-eaccelerator-42067ac
# /usr/local/php/bin/phpize
# ./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config
# make && make install
# mkdir /tmp/eaccelerator
# chmod 777 /tmp/eaccelerator/
# echo "extension = eaccelerator.so" >> /usr/local/php/etc/php.ini
(7)zend
# tar zxf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz
# mkdir /usr/local/zend
# cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64/php-5.4.x/ZendGuardLoader.so /usr/local/zend/
# vi /usr/local/php/etc/php.ini

zend_loader.enable = 1

zend_extension=/usr/local/zend/ZendGuardLoader.so
zend_loader.enable=1
zend_loader.disable_licensing=0
zend_loader.obfuscation_level_support=3
zend_loader.license_path=
5.测试
# /etc/init.d/php-fpm start
# /etc/init.d/mysql start
# /etc/init.d/nginxd start
nginx访问正常
# echo -e "" > /usr/local/nginx/html/phpinfo.php
# vi mysql.php
$conn = mysql_connect("127.0.0.1","root","123456") or die("connect err: ".mysql_error());
echo "The success of MySQL links ! ";
?>
mysql链接成功
apc扩展
memcache扩展
redis扩展
imagick扩展
magickwand扩展
eaccelerator 扩展




ZendGuardLoader扩展


ipcon879498 发表于 2015-4-25 21:33:17

全是命令,也没有文字解说是什么意思.就算这样我也能看懂!!
页: [1]
查看完整版本: linux下基于电商平台lnmp部署