LNMP架构介绍
访问静态文件多的网页,nginx比apache快很多,支持高并发。
mysql安装
php安装
useradd php-fpm
先安装yum install libcurl-devel -y
- 解压后,进入php目录中执行下面命令:
./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-dpo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
- make && make install
- cp php.ini-production /usr/local/php-fpm/etc/php.ini
- vi /usr/local/php-fpm/etc/php-fpm.conf
[global]pid = /usr/local/php-fpm/var/run/php-fpm.piderror_log = /usr/local/php-fpm/var/log/php-fpm.log[www]listen = /tmp/php-fcgi.socklisten.mode = 666user = php-fpmgroup = php-fpmpm = dynamicpm.max_children = 50pm.start_servers = 20pm.min_spare_servers = 5pm.max_spare_servers = 35pm.max_requests = 500rlimit_files = 1024
- cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm 复制启动脚本
- chmod 755 /etc/init.d/php-fpm
- chkconfig --add php-fpm 添加开机启动 chkconfig php-fpm on service php-fpm start 启动php-fpm
成功开启!