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负载均衡:
-
基于轮询:
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; } } }
-
基于权重
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; } } }
-
基于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