安裝php-5.4.4
# tar -jxvf php-5.4.4.tar.bz2
# cd php-5.4.4
# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --enable-fpm --enable-sockets --enable-sysvshm --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-libxml-dir=/usr --enable-xml --with-mhash --with-mcrypt --with-config-file-path=/etc/php --with-config-file-scan-dir=/etc/php --with-bz2 --with-curl
# make
# make install
複製主配置檔案
# cp php.ini-production /etc/php.ini
服務指令碼
# cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
# chmod +x /etc/rc.d/init.d/php-fpm
修改php-fpm配置檔案
# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# vim /usr/local/php/etc/php-fpm.conf
pid = run/php-fpm.pid
pm.max_children = 50 最多多少子程序
pm.start_servers = 5 剛開始啟動多少程序
pm.min_spare_servers = 2 最少多少空閒程序
pm.max_spare_servers = 8 最多多少空閒程序
# service php-fpm start
location ~ \.php$
fastcgi_param script_filename $document_root$fastcgi_script_name;
新增php格式的主頁,如下所示:
location /
重啟服務:
# service nginx restart
寫入測試檔案,訪問檢視
Nginx PHP環境搭建
root nginxphp uname a linux nginxphp 3.10.0 514.el7.x86 64 root nginxphp cat etc redhat release centos linux release 7.3.1611 core yum install nginx y...
Linux下 nginx php環境搭建
一 安裝nginx 1.在 etc yum.repos.d 目錄下建立以檔案nginx.repo vi etc yum.repos.d nginx.repo 內容如下 nginx name nginx repo baseurl gpgcheck 0 enabled 1 2.安裝nginx yum i...
Linux下 nginx php 環境搭建
一 安裝nginx 1.在 etc yum.repos.d 目錄下建立以檔案 nginx.repo vi etc yum.repos.d nginx.repo 內容如下 nginx name nginx repo baseurl gpgcheck 0 enabled 1 2.安裝nginx yum ...