全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 2415|回复: 3

大佬帮我看看这个 nginx 配置文件是干嘛的

[复制链接]
发表于 2017-4-24 06:57:46 | 显示全部楼层 |阅读模式
本帖最后由 nic2013 于 2017-4-24 06:59 编辑


主要是启什么作用 ?




  1. #user  nobody;
  2. worker_processes  3;

  3. #error_log  logs/error.log;
  4. #error_log  logs/error.log  notice;
  5. #error_log  logs/error.log  info;

  6. #pid        logs/nginx.pid;


  7. events {
  8.     worker_connections  1024;

  9. }


  10. http {
  11.     include       mime.types;
  12.     default_type  application/octet-stream;

  13.     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
  14.     #                  '$status $body_bytes_sent "$http_referer" '
  15.     #                  '"$http_user_agent" "$http_x_forwarded_for"';

  16.     #access_log  logs/access.log  main;

  17.     sendfile        on;
  18.     #tcp_nopush     on;

  19.     #keepalive_timeout  5s;
  20.     #keepalive_timeout  65;
  21.     upstream myServer{
  22.    
  23.     server 115.159.69.236:81 weight=1;
  24.     server 115.159.69.236:82 weight=1;
  25.     server 115.159.69.236:83 weight=1;
  26.     server 115.159.69.236:84 weight=1;
  27.     server 115.159.69.236:85 weight=1;
  28.     server 115.159.69.236:86 weight=1;
  29.     server 115.159.69.236:87 weight=1;
  30.     server 115.159.69.236:88 weight=1;
  31.     server 115.159.69.236:89 weight=1;
  32.     server 115.159.69.236:90 weight=1;
  33.     server 115.159.69.236:91 weight=1;
  34.     server 115.159.69.236:92 weight=1;
  35.     server 115.159.69.236:93 weight=1;
  36.     server 115.159.69.236:94 weight=1;
  37.     server 115.159.69.236:95 weight=1;
  38.     keepalive 10;
  39.     }

  40.     #gzip  on;

  41.     server {
  42.         listen       80;
  43.         server_name  localhost;


  44.         #charset koi8-r;

  45.         #access_log  logs/host.access.log  main;

  46.         location / {
  47.         #proxy_connect_timeout 1;
  48.         proxy_send_timeout 10;
  49.         proxy_read_timeout 10;
  50.         #proxy_ignore_client_abort on;
  51.         proxy_http_version 1.1;
  52.         #proxy_set_header Upgrade $http_upgrade;
  53.         proxy_set_header Connection keep-alive;
  54.         proxy_set_header Host $host;

  55.         proxy_pass http://myServer;
  56.             #root   html;
  57.             #index  index.html index.htm;
  58.         }

  59.         #error_page  404              /404.html;

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

  66.         # proxy the PHP scripts to Apache listening on 115.159.69.236:80
  67.         #
  68.         #location ~ \.php$ {
  69.         #    proxy_pass   http://115.159.69.236;
  70.         #}

  71.         # pass the PHP scripts to FastCGI server listening on 115.159.69.236:9000
  72.         #
  73.         #location ~ \.php$ {
  74.         #    root           html;
  75.         #    fastcgi_pass   115.159.69.236:9000;
  76.         #    fastcgi_index  index.php;
  77.         #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
  78.         #    include        fastcgi_params;
  79.         #}

  80.         # deny access to .htaccess files, if Apache's document root
  81.         # concurs with nginx's one
  82.         #
  83.         #location ~ /\.ht {
  84.         #    deny  all;
  85.         #}
  86.     }


  87.     # another virtual host using mix of IP-, name-, and port-based configuration
  88.     #
  89.     #server {
  90.     #    listen       8000;
  91.     #    listen       somename:8080;
  92.     #    server_name  somename  alias  another.alias;

  93.     #    location / {
  94.     #        root   html;
  95.     #        index  index.html index.htm;
  96.     #    }
  97.     #}


  98.     # HTTPS server
  99.     #
  100.     #server {
  101.     #    listen       443 ssl;
  102.     #    server_name  localhost;

  103.     #    ssl_certificate      cert.pem;
  104.     #    ssl_certificate_key  cert.key;

  105.     #    ssl_session_cache    shared:SSL:1m;
  106.     #    ssl_session_timeout  5m;

  107.     #    ssl_ciphers  HIGH:!aNULL:!MD5;
  108.     #    ssl_prefer_server_ciphers  on;

  109.     #    location / {
  110.     #        root   html;
  111.     #        index  index.html index.htm;
  112.     #    }
  113.     #}

  114. }
复制代码
发表于 2017-4-24 07:00:47 来自手机 | 显示全部楼层
负载均衡,反代理
发表于 2017-4-24 07:01:40 来自手机 | 显示全部楼层
如果有人d挂一个ip会自动连别的可用IP
发表于 2017-4-30 11:39:42 | 显示全部楼层
后端15台服务器的负载均衡集群。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-3-29 17:45 , Processed in 0.082355 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表