zoukankan      html  css  js  c++  java
  • 8-day8-samba-nginx

    SAMBA:

    关闭防火墙:

        iptables -F
        systemctl disable firewalld
        systemctl stop firewalld
        systemctl status firewalld
    

    安装samba:

    yum install samba
    /etc/samba/smb/comf   //配置文件路径
    sysctl samba start    //修改配置文件需要重启
    

    创建samba用户:

    adduser zhw       //创建无密码系统用户
    smbpasswd -a zhw  //为smb用户创建密码
    //新建samba用户 即系统用户,新建用户不设置密码(所以不能登录)
    

    配置一:每个用户有自己的目录,可以浏览删除内容

    添加用户:  
    
        adduser user1 user2 user3
        smbpasswd user1  
        smbpasswd user2
        smbpasswd user3
    

    . 配置文件 /etc/samba/smb.conf

        [homes]
        comment = Home Directories
        valid users = %S, %D%w%S
        browseable = No
        read only = No
        inherit acls = Yes
    

    . 访问方式

        \192.168.16.107user1    user1 password
        \192.168.16.107user2    user2 password
        \192.168.16.107user3    user3 password
    

    遇到的问题:


    解决方法

    配置二:所有用户共享一个目录,只能浏览内容,不能删

    配置文件:

    [public]
    comment =Public Stuff
    path =/home/zhw
    public=yes
    writable =no
    printable =no
    write list =user1,user2,user3
    

    现在user1 user2 user3 三个用户可以访问192.168.16.107public,切只有读权限

    Nginx

    安装方式:

    yum install epel-relase
    yum install nginx         //epel方式安装
    ./configure --prefix=/usr/local/nginx --without-http_write_module       //编译安装
    

    启动方式:

    /usr/local/nginx/sbin/nginx -c /usr/lcoal/nginx/conf/nginx.conf
    /usr/local/nginx/sbin/nginx -s reload
    

    nginx负载均衡:

    1. 基于轮询:

      http{
          upstream myweb{
              server 10.0.0.10;
              server 10.0.0.11;
              server 10.0.0.12;
      }
          server{
              listen 80;
              location /{
                  proxy_pass http://myweb;
              }
          }
      }
      
    2. 基于权重

      http{
          upstream myweb{
              server 10.0.0.10 weight=2;
              server 10.0.0.11 weight=1;
              server 10.0.0.12 weight=3;
      }
          server{
              listen 80;
              location /{
                  proxy_pass http://myweb;
              }
          }
      }
      
    3. 基于IP

    [root@bogon home]# cat 1.conf

        http{
            upstream myweb{
                ip_hash;
                server 10.0.0.10;
                server 10.0.0.11;
                server 10.0.0.12;
        }
            server{
                listen 80;
                location /{
                    proxy_pass http://myweb;
                }
            }
        }
    

    vim ctrl+v 进入可视块模式 hostnamectl set-hostname cx2c

  • 相关阅读:
    python递归函数
    python全局替换文件内容脚本第1版
    python的if判断补充
    python装饰器
    python函数作用域
    python函数基础
    python文件操作
    ASCII、Unicode和UTF-8编码的区别
    python基础(二)----数据类型
    python基础第一章
  • 原文地址:https://www.cnblogs.com/cx2c/p/6925684.html
Copyright © 2011-2022 走看看