• 配置安装nginx+php(5.4.14)安装、配置详解(负载均衡)


    发一下牢骚和主题无关:

        这里仅供给简单的配置示例,关于比较具体的配置文件的信息,当前再做交流

        实验环境:

        系统:centos6.2  linux 2.6内核

        php version: 5.4.14 (当前最新)

        nginx version : 1.3.16 (当前最新)

        

    1.配置框图

        配置的框架图如下:

        配置和安装

        可以看到有三台呆板

        连接代理:192.168.66.20 其它两台为后台服务器,IP与监听端口上面已表明

        

        

    2.代理的安装与配置

        nginx 的安装比较简单了,具体内容请参照:http://blog.csdn.net/rao_warrior/article/details/8948063

        对nginx的配置如下:

        下面的配置文件中,为了理解便利,我把部份临时不需要的东西都给删掉了

        #user  nobody; 
    worker_processes  1;

    #error_log  logs/error.log;
    #error_log  logs/error.log  notice; 
    #error_log  logs/error.log  info;

    #pid        logs/nginx.pid;

    events {
        worker_connections  1024;
    }

    http {
        include       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  logs/access.log  main;

        sendfile        on;     
        #tcp_nopush     on;     

        #keepalive_timeout  0;
        keepalive_timeout  65;

        #gzip  on;

        upstream myproject {
            server 192.168.66.11:9000 ;
            server 192.168.66.10:9000 ;
        }

       server {
            listen       80;
            server_name  192.168.66.20;

        每日一道理
    俄国作家契诃夫说:“有大狗,有小狗,小狗不该因为大狗的存在而心慌意乱。所有的狗都应该叫,就让他各自用上帝给他的声音。

                #charset koi8-r;

            #access_log  logs/host.access.log  main;

            location / {
                root   html;
                index  index.html index.htm;
            }

            #error_page  404              /404.html;

            # redirect server error pages to the static page /50x.html
            #
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }

            # proxy the PHP scripts to Apache listening on 127.0.0.1:80
            #
            #location ~ \.php$ {
            #    proxy_pass   http://192.168.66.20;
            #
            #}

            # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
            #
            location ~ \.php$ {
                root           html;
                fastcgi_pass   myproject ;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  /home/php/$fastcgi_script_name;  #指定后台server的php网站寄存的目录
                include        fastcgi_params;
            }

        }
    }

        

        

    3.后台server的安装配置

        

    3.1php的安装与配置

        具体安装信息,请参考:http://blog.csdn.net/rao_warrior/article/details/8948063

        配置/usr/local/etc/php-fpm.conf文件如下:

        找到  listen = 127.0.0.1:9000 这一行,改成:

        listen = 192.168.66.10:9000   #以server 192.168.66.10为例

        启动php-fpm 就OK

        

        

        

        

        

        

        

        

        

        

        

        

    文章结束给大家分享下程序员的一些笑话语录: 据说有一位软件工程师,一位硬件工程师和一位项目经理同坐车参加研讨会。不幸在从盘山公路下山时坏在半路上了。于是两位工程师和一位经理就如何修车的问题展开了讨论。
    硬件工程师说:“我可以用随身携带的瑞士军刀把车坏的部分拆下来,找出原因,排除故障。”
    项目经理说:“根据经营管理学,应该召开会议,根据问题现状写出需求报告,制订计划,编写日程安排,逐步逼近,alpha测试,beta1测试和beta2测试解决问题。”
    软件工程说:“咱们还是应该把车推回山顶再开下来,看看问题是否重复发生。”

    --------------------------------- 原创文章 By
    配置和安装
    ---------------------------------

  • 相关阅读:
    linux之vi编辑器的基础命令
    redis的安装部署启动停止<17.3.21已更新>
    关于Ubuntu的ssh免密登录
    Git(管理修改)
    Git(时光机-版本回退)
    Git(查看修改记录)
    Git(创建版本库)
    集中式VS分布式
    Git(介绍和安装)
    Javascript基础知识
  • 原文地址:https://www.cnblogs.com/xinyuyuanm/p/3102416.html
Copyright © 2020-2023  润新知