www.zyan.cc 和 blog.zyan.cc 域名均指向 Nginx 所在的服务器IP。

  用户访问http://www.zyan.cc,将其负载均衡到192.168.1.2:80、192.168.1.3:80、192.168.1.4:80、192.168.1.5:80四台服务器。

  用户访问http://blog.zyan.cc,将其负载均衡到192.168.1.7服务器的8080、8081、8082端口。

  以下为配置文件nginx.conf:

引用
user  www www;

worker_processes 10;

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

#pid        logs/nginx.pid;

#最大文件描述符
worker_rlimit_nofile 51200;

events
{
      use epoll;

      worker_connections 51200;
}

http
{
      include       conf/mime.types;
      default_type  application/octet-stream;

      keepalive_timeout 120;

      tcp_nodelay on;

      upstream  www.zyan.cc  {
              server   192.168.1.2:80;
              server   192.168.1.3:80;
              server   192.168.1.4:80;
              server   192.168.1.5:80;
      }

      upstream  blog.zyan.cc  {
              server   192.168.1.7:8080;
              server   192.168.1.7:8081;
              server   192.168.1.7:8082;
      }

      server
      {
              listen  80;
              server_name  www.zyan.cc;

              location / {
                       proxy_pass        http://www.zyan.cc;
                       proxy_set_header   Host             $host;
                       proxy_set_header   X-Real-IP        $remote_addr;
                       proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
              }

              log_format  www_s135_com  '$remote_addr - $remote_user [$time_local] $request '
                                '"$status" $body_bytes_sent "$http_referer" '
                                '"$http_user_agent" "$http_x_forwarded_for"';
              access_log  /data1/logs/www.log  www_s135_com;
      }

      server
      {
              listen  80;
              server_name  blog.zyan.cc;

              location / {
                       proxy_pass        http://blog.zyan.cc;
                       proxy_set_header   Host             $host;
                       proxy_set_header   X-Real-IP        $remote_addr;
                       proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
              }

              log_format  blog_s135_com  '$remote_addr - $remote_user [$time_local] $request '
                                '"$status" $body_bytes_sent "$http_referer" '
                                '"$http_user_agent" "$http_x_forwarded_for"';
              access_log  /data1/logs/blog.log  blog_s135_com;
      }
}

  附:Nginx 的安装方法可参照《Nginx 0.5.31 + PHP 5.2.4(FastCGI)搭建可承受3万以上并发连接数,胜过Apache 10倍的Web服务器》文章的以下段落(仅做负载均衡,无需支持PHP的安装方法):

  二、安装PHP 5.2.4(FastCGI模式)
  4、创建www用户和组,以及其使用的目录:

  三、安装Nginx 0.5.31
  1、安装Nginx所需的pcre库:
  2、安装Nginx
  3、创建Nginx日志目录
  5、启动Nginx





技术大类 » Web服务器 | 评论(97) | 引用(0) | 阅读(213396)
mrseo Email
2022-6-2 15:17
Hello! I just wish to give an enormous thumbs up for the nice info you've got right here on this post. I will probably be coming back to your weblog for more soon!    https://www.here4business.net/
mrseo Email
2022-6-2 15:23
Really impressive post. I read it whole and going to share it with my social circules. I enjoyed your article and planning to rewrite it on my own blog.   https://www.simple-internet-strategies.com/
mrseo Email
2022-6-2 15:25
I am overwhelmed by your post with such a nice topic. Usually I visit your blogs and get updated through the information you include but today’s blog would be the most appreciable. Well done!   https://solarizelsw.org/
mrseo Email
2022-6-2 15:28
I am impressed by the information that you have on this blog. It shows how well you understand this subject.   https://amarketinganalytics.com/
mrseo Email
2022-6-2 15:29
It proved to be Very helpful to me and I am sure to all the commentators here!   https://gardenvirtualtours.com/
mrseo Email
2022-6-2 15:32
This is a fantastic website and I can not recommend you guys enough.   https://www.assimilatedasylum.com/
mrseo Email
2022-6-2 15:34
I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day!   https://www.researchingreadersonline.com/
mrseo Email
2022-6-2 15:36
Admiring the time and effort you put into your blog and detailed information you offer!..   https://www.reo-insider.com/
mrseo Email
2022-6-2 15:38
Nice information, valuable and excellent design, as share good stuff with good ideas and concepts, lots of great information and inspiration, both of which I need, thanks to offer such a helpful information here.   https://jobopp.biz/
mrseo Email
2022-6-2 15:41
I think I have never seen such blogs ever before that has complete things with all details which I want. So kindly update this ever for us.   https://www.thewebbanner.com/
mrseo Email
2022-6-2 15:43
Really impressive post. I read it whole and going to share it with my social circules. I enjoyed your article and planning to rewrite it on my own blog.    https://www.johnbyrnesmd.org/
mrseo Email
2022-6-2 15:45
I am overwhelmed by your post with such a nice topic. Usually I visit your blogs and get updated through the information you include but today’s blog would be the most appreciable. Well done!   https://lewishamconnections.org/
mrseo Email
2022-6-2 15:48
It proved to be Very helpful to me and I am sure to all the commentators here!   https://www.dylaniumknits.com/
mrseo Email
2022-6-2 15:51
I just found this blog and have high hopes for it to continue. Keep up the great work, its hard to find good ones. I have added to my favorites. Thank You.   https://www.californiapartnership.org/
mrseo Email
2022-6-2 15:55
I am a new user of this site so here i saw multiple articles and posts posted by this site,I curious more interest in some of them hope you will give more information on this topics in your next articles.   https://www.paintedrainbarrel.org/
Nuch1122 Email
2022-6-27 20:01
เกมสล็อต ค่าย pgนนี้จะมาแนะนำเกมสล็อตยอดฮิตทั้งหมด 7 เกมที่กำลังได้รับความนิยมเป็นอย่างมาก ด้วย ภาพ เนื้อหาของเกม และที่สำคัญแตกง่ายมากๆ อีกด้วย กับ สล็อต 2022
shz Email
2022-8-6 19:44
Thanks for providing recent updates regarding the concern, I look forward to read more.  just one dime review
shz Email
2022-8-6 19:54
A good blog always comes-up with new and exciting information and while reading I have feel that this blog is really have all those quality that qualify a blog to be a one.  private label masters reviews
shz Email
2022-8-6 20:02
I curious more interest in some of them hope you will give more information on this topics in your next articles.  private label masters reviews
shz Email
2022-8-6 20:06
It is perfect time to make some plans for the future and it is time to be happy. I’ve read this post and if I could I desire to suggest you few interesting things or tips. Perhaps you could write next articles referring to this article. I want to read more things about it!  private label masters reviews
分页: 4/5 第一页 上页 1 2 3 4 5 下页 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]