0
点赞
收藏
分享

微信扫一扫

Mac文件需要分卷压缩怎么办 Mac上怎么解压分卷压缩的文件

目录

一、配置文件详解

1.1、结构

1.2、重要配置解释 

 1.3、详细配置

全局配置

 Events

HTTP 服务器配置 

 server虚拟主机配置

location URL匹配配置 

1.4、完整配置 

二、负载均衡

2.1、概念

2.2、集群规划及实现 

2.3、具体实现

2.3.1、克隆

2.3.2、修改tomcat1配置

启动测试

2.3.3、修改tomcat2配置 

启动测试

 2.3.4、负载均衡配置

2.3.4.1、轮询roundrobin(默认)

2.3.4.2、weight:指定轮询权值

2.3.4.3、ip_hash 

 2.3.4.4、fair(公平)

2.3.4.5、url_hash 


一、配置文件详解

1.1、结构

1.2、重要配置解释 

 1.3、详细配置

全局配置

 Events

HTTP 服务器配置 

 server虚拟主机配置

location URL匹配配置 

1.4、完整配置 

#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 my_server {                                                         
 server 192.168.23.112:8080;                                                  
    keepalive 2000;
}
    server {
        listen       80;
        server_name  localhost;
 
        #charset koi8-r;
 
        #access_log  logs/host.access.log  main;
 
        location / {
            root   html;
            index  index.html index.htm;
        }
  location /my/ {
        proxy_pass http://my_server/;
    }
        #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://127.0.0.1;
        #}
 
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.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;
        #}
 
        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }
 
 
    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;
 
    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
 
 
    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;
 
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;
 
    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;
 
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;
 
    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
}

二、负载均衡

2.1、概念

2.2、集群规划及实现 

2.3、具体实现

2.3.1、克隆

使用之前的tomcat克隆一个tomcat2,记住要修改tomcat的ip地址,并用远程连接工具连上

2.3.2、修改tomcat1配置

cp -r /usr/apache-tomcat-9.0.52/ /usr/tomcat1
cp -r /usr/apache-tomcat-9.0.52/ /usr/tomcat2
cp -r /usr/apache-tomcat-9.0.52/ /usr/tomcat3

分别修改tomcat1,2,3的server.xml配置和随便改一个页面,知道访问的是当前端口下的项目就行:拿tomcat1举例

启动测试
/usr/tomcat1/bin/startup.sh
/usr/tomcat2/bin/startup.sh
/usr/tomcat3/bin/startup.sh

2.3.3、修改tomcat2配置 

cp -r /usr/apache-tomcat-9.0.52/  /usr/tomcat4
cp -r /usr/apache-tomcat-9.0.52/  /usr/tomcat5
cp -r /usr/apache-tomcat-9.0.52/  /usr/tomcat6

修改配置和上面一样,这里就不演示了

启动测试
/usr/tomcat4/bin/startup.sh
/usr/tomcat5/bin/startup.sh
/usr/tomcat6/bin/startup.sh

 2.3.4、负载均衡配置

2.3.4.1、轮询roundrobin(默认)
vim /usr/local/nginx/conf/nginx.conf

#重启nginx服务
/usr/local/nginx/sbin/nginx -s reload

测试:

2.3.4.2、weight:指定轮询权值

修改配置

vim /usr/local/nginx/conf/nginx.conf
upstream loadbalanceserver {
		server  192.168.37.181:8081;
		server  192.168.37.181:8082;
		server  192.168.37.181:8083 weight=50;
		server  192.168.37.182:8084;
		server  192.168.37.182:8085;
		server  192.168.37.182:8086 weight=100;
	}

重启nginx服务

/usr/local/nginx/sbin/nginx -s reload
2.3.4.3、ip_hash 
upstream  myservers {
         ip_hash;
         server 192.168.170.11:8081;
         server 192.168.170.11:8082;
         server 192.168.170.11:8083 weight=20;
         server 192.168.170.12:8084;
         server 192.168.170.12:8085;
         server 192.168.170.12:8086;
    }
 2.3.4.4、fair(公平)

不演示了

2.3.4.5、url_hash 

不演示了

举报

相关推荐

0 条评论