LNMP架構介紹,php安裝

LNMP架構介紹

訪問靜態文件多的網頁,nginx比apache快不少,支持高併發。php

mysql安裝

php安裝mysql

useradd php-fpmnginx

先安裝yum install libcurl-devel -ysql

  • 解壓後,進入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-exifapache

  • 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.pid
error_log = /usr/local/php-fpm/var/log/php-fpm.log
[www]
listen = /tmp/php-fcgi.sock
listen.mode = 666
user = php-fpm
group = php-fpm
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
rlimit_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

成功開啓!api

相關文章
相關標籤/搜索