Nginx Backend agent multiple PHP-FPM server; (add a previous blog)

Source: Internet
Author: User

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/E9/wKioL1WLs4ihtyTBAACes8o-JyE319.jpg "title=" 666. PNG "alt=" wkiol1wls4ihtytbaaces8o-jye319.jpg "/>

Nginx Server Settings

[email protected] ~]# Yum Installnginx # Install Nginx

[Email protected] ~]# cd/etc/nginx/

[Email protected] nginx]# vim nginx.conf

http {    include       /etc/nginx/mime.types;     default_type  application/octet-stream;     log_ format main   ' $remote _addr -  $remote _user[$time _local]  "$request"   "                         ' $status   $body _bytes_sent "$http _referer   '                        ' $http _user_agent '   "$http _x_forwarded_for" ';     access_log /var/log/nginx/access.log   main;     sendfile        on;      #tcp_nopush      on;     keepalive_timeout   65;      #gzip  on;            upstream  fastcgiserver {  #设置后端php-FPM Server IP and Port         server  192.168.10.63:9000;           server  192.168.10.64:9000;        }             include /etc/nginx/conf.d/*.conf;}

[Email protected] nginx]# cd/etc/nginx/conf.d/

[email protected] conf.d]# CP default.conf Default.conf.bak

[Email protected] conf.d]# vimdefault.conf

    location ~ \.php$ {         root           /www ;      #php-fpm The *.php paging file on the server         # Fastcgi_pass   127.0.0.1:9000;        fastcgi_pass    fastcgiserver;   #这里调用upstream设置;         fastcgi_index  index.php;        fastcgi_param   script_filename   $document _root$fastcgi_script_name;         include        fastcgi_params;    } 

[[email protected] conf.d]# Servicenginx Restart # start nginx service


PHP-FPM Server Settings ( server03 and the server04 the same configuration)

[[Email protected]~]# mkdir/www # Create php file directory

[[Email protected]~]# vim/www/index.php # Create PHP homepage, display php information

<?phpecho "SERVER03"; #这里仅仅用来识别server03和server04 phpinfo ()?>

[[Email protected]~]# yum Install php-fpm # installation PHP-FPM

[[email protected]~]# vim/etc/php-fpm.d/www.conf     # configuration file modification

; the address onwhich to accept fastcgi requests.;  Valid syntaxesare:;    ' Ip.add.re.ss:port '     - to  listen on a tcp socket to a specificaddress on;                              a specific port;;     ' Port '                   - to listen on a tcp socket toall addresses on  a;                             specific port;;     '/path/to/unix/socket '  - to listen on a unixsocket.;  note:&nbSp thisvalue is mandatory.; listen = 127.0.0.1:9000listen = 192.168.10.63   #改成自己的IP地址  ; List  of ipv4addresses of fastcgi clients which are allowed to connect.;  Equivalent tothe FCGI_WEB_SERVER_ADDRS environment variable in the  ORIGINAL;&NBSP;PHP&NBSP;FCGI (5.2.2+).  makes sense only with a tcp listening  socket. each address; must beseparated by a comma. if this  value is left blank, connections will be; accepted fromany  ip address.;  Default Value:any;listen.allowed_clients =127.0.0.1        listen.allowed_clients = 192.168.10.66  #设置允许连接到  FastCGI  Server  IPV4  address. If you allow all of this, then just drop the comment.

[[Email protected] ~]# service php-fpm start # Start PHP-FPM


Test results: You can see here are called Server03 and server04 two servers, each refresh will poll;

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6E/ED/wKiom1WLsmOTl4uAAAGbzSkzRkg922.jpg "style=" width : 700px;height:152px; "title=" 444.png "width=" "height=" border= "0" hspace= "0" vspace= "0" alt= " Wkiom1wlsmotl4uaaagbzskzrkg922.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6E/E9/wKioL1WLtB-AtsM0AAM4REoU8nE633.jpg "style=" width : 700px;height:260px; "title=" 555.png "width=" "height=" 260 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiol1wltb-atsm0aam4reou8ne633.jpg "/>




This article is from the "obsessed" blog, make sure to keep this source http://dragondragon.blog.51cto.com/6170889/1665603

Nginx Backend agent multiple PHP-FPM server; (add a previous blog)

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.