NGINX+PHP5-FPM Installation

Source: Internet
Author: User
Tags fpm

First, the basic Environment 1, cat /etc/debian_version 7.82, uname -r3.2.0-4-amd643, IP (eth0) 10.0.0.1094, nginx version 1.4.72, Install NGINX1, install the required base package Apt-get -y install libpcre3-dev libpcre3 libssl-dev zlib1g-dev  make2, build nginx user 1) groupadd nginx2) USERADD&NBSP;NGINX&NBSP;-G&NBSP;NGINX&NBSP;-S&NBSP;/BIN/FALSE3, Download Nginxaxel -n 10 http://nginx.org/download/nginx-1.4.7.tar.gz4, unzip tar zxvf  nginx-1.4.7.tar.gz && cd nginx-1.4.75, compilation Trilogy 1) ./configure --prefix=/opt/nginx  --user=nginx --group=nginx --with-http_ssl_module2) Make && make install6, Parameter description--prefix=/opt/nginx     The installation path is specified in the/opt/nginx http_ssl_module     &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;HTTPS Protocol Module http_gzip_module         The response module of the compressed HTTP server http_rewrite_module      Rewrite module--user=nginx              nginx User  --group=nginx           nginx Group 7, To facilitate   get a soft link ln -s /opt/nginx/sbin/nginx /usr/local/sbin/nginx8, modify nginx configuration file to support PHP-FPM1) first back up the CP &NBSP;/OPT/NGINX/CONF/NGINX.CONF&NBSP;/OPT/NGINX/CONF/NGINX.CONF.BAK2) Modify the following content 2c2< user nginx;--- >  #user   nobody;36,39c36,38<         listen        10.0.0.109:80;<          server_name  10.0.0.109;<         access_log  /opt/nginx/logs/10.0.0.109.access.log;<         error_ log /opt/nginx/logs/10.0.0.109.error.log;--->          listen       80;>          Server_name  locAlhost;> 66,72c65,71<         location ~ \. php$ {<             root            html;<              fastcgi_pass   unix:/run/shm/php5-fpm.sock;<              fastcgi_index  index.php;<              fastcgi_param  script_ filename   $document _root$fastcgi_script_name;<              include        fastcgi_params;<  &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP,--->          #location &NBSP;~&NBSP;\.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;>          #}9, start Nginx service nginx10, view port and process 1) netstat -tupnl|grep nginxtcp         0      0 10.0.0.109:80            0.0.0.0:*             &NBSP;&NBSP;&NBSP;LISTEN&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;13852/NGINX:&NBSP;MASTER2) Ps -ef |grep  nginxroot     13852     1  0 22:51  ?        00:00:00 nginx: master process  nginxnginx    13853 13852  0 22:51 ?         00:00:00 nginx: worker processnginx    13907  13906&NBSP;&NBSP;0&NBSP;22:52&NBSP;?&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;00:00:00&NBSP;PHP-FPM:  pool www                                           nginx    13908 13906  0 22:52 ?         00:00:00 php-fpm: pool www  ps:1, stop Nginx service nginx -s  quit2, reload configuration nginx -s reload Three, install PHP5-FPM1, install PHP5-FPM and phpapt-get -y install  PHP5-CLIAPT-GET&NBSP;-Y&NBSP;INSTALL&NBSP;PHP5-FPM2, modify PHP-FPM profile 1) first back up the next cp /etc/php5/fpm/pool.d/www.conf &NBSP;/ETC/PHP5/FPM/POOL.D/WWW.CONF.BAK2) Modify the following content diff /etc/php5/fpm/pool.d/www.conf /etc/php5/fpm/ Pool.d/www.conf.bak 22,23c22,23< user = nginx< group = nginx--->  user = www-data> group = www-data33c33< listen = /run/shm/ Php5-fpm.sock---> listen = /var/run/php5-fpm.sock44,46c44,46< listen.owner =  nginx< listen.group = nginx< listen.mode = 0660--->  Listen.owner = www-data> listen.group = www-data> ;listen.mode = 06603, restart PHP-FPM service/etc/init.d/ PHP5-FPM&NBSP;RESTART4, viewing process ps -ef |grep phproot     13906      1  0 22:52 ?        00:00:00  php-fpm: master process  (/etc/php5/fpm/php-fpm.conf)        nginx    13907 13906  0 22:52 ?         00:00:00 php-fpm: pool www                                           nginx     13908 13906  0 22:52 ?         00:00:00 php-fpm: pool www    Four, write a php file Test cat /opt/nginx/html/info.php <?phpphpinfo ();? >; Five, the effect

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6F/C3/wKioL1WnzcGSj2TZAAPvzqXiyQM055.jpg "title=" Aaa.jpg "alt=" Wkiol1wnzcgsj2tzaapvzqxiyqm055.jpg "/>

This article is from the "7928217" blog, please be sure to keep this source http://7938217.blog.51cto.com/7928217/1675483

NGINX+PHP5-FPM Installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.