nginx與PHP配置
阿新 • • 發佈:2018-10-13
php-fpm roo fix ive string idt sysv def www
--with-curl \
--with-freetype-dir \
--with-gd \
--with-gettext \
--with-iconv-dir \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml-dir \
--with-mysqli \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear \
--with-png-dir \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--enable-fpm \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-gd-native-ttf \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip 3.編譯安裝 # make && make install 4配置文件
# cp php.ini-development /usr/local/php/lib/php.ini
# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf # cp -R ./sapi/fpm/php-fpm /etc/init.d/php-fpm 5修改php-fpm配置文件
php-fpm配置文件位置:(/etc/php-fpm.d/www.conf)
? 修改
user =www-data
? group=www-data 三、配置nginx解析php location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
} 在/usr/loca/nginx/html/test.php <?php
phpinfo();
?> 重啟nginx /use/local/sbin/ -s reload 啟動php /usr/local/php/bin/php-fpm 四 、訪問http://192.168.3.81/test.php
一、安裝依賴包
yum -y install libxml2 libxml2-devel openssl openssl-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype pcre pcre-devel libxslt libxslt-devel bzip2 bzip2-devel 二、安裝php 1.下載php7.0 wget http://php.net/get/php-7.0.2.tar.gz/from/a/mirror 2.解壓安裝 # tar zxvf php-7.0.2.tar.gz # cd php-7.0.2 首先查看安裝幫助 # ./configure --help # ./configure --prefix=/usr/local/php \--with-curl \
--with-freetype-dir \
--with-gd \
--with-gettext \
--with-iconv-dir \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml-dir \
--with-mysqli \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear \
--with-png-dir \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--enable-fpm \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-gd-native-ttf \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip 3.編譯安裝 # make && make install 4配置文件
# cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf # cp -R ./sapi/fpm/php-fpm /etc/init.d/php-fpm 5修改php-fpm配置文件
php-fpm配置文件位置:(/etc/php-fpm.d/www.conf)
? 修改
user =www-data
? group=www-data 三、配置nginx解析php location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
} 在/usr/loca/nginx/html/test.php <?php
phpinfo();
?> 重啟nginx /use/local/sbin/ -s reload 啟動php /usr/local/php/bin/php-fpm 四 、訪問http://192.168.3.81/test.php
nginx與PHP配置