nginx +php 环境筹建之php安装

WBOY
Release: 2016-06-13 11:34:44
Original
768 people have browsed it

nginx +php 环境搭建之php安装

?

安装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  最多多少空闲进程  <span>#?service?php-fpm?start </span>
Copy after login

?编辑/etc/nginx/nginx.conf,启用如下选项:

?

    location ~ \.php$ {                  root           html;                  fastcgi_pass   127.0.0.1:9000;                  fastcgi_index  index.php;                  fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;                  include        fastcgi_params;              }  
Copy after login

?

编辑/etc/nginx/fastcgi_params,添加修改如下内容:

?

fastcgi_param? SCRIPT_FILENAME??? $document_root$fastcgi_script_name;

?

添加php格式的主页,如下所示:
location / {
??????????? root?? html;
??????????? index? index.php index.html index.htm;
??????? }
???????
重启服务:
# service nginx restart

写入测试文件,访问查看

?

?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!