Linux基础系列:常用命令(5)_samba服务与nginx服务
作业一:部署samba
每个用户有自己的目录,可以浏览内容,也可以删除
所有的用户共享一个目录,只能浏览内容,不能删
安装samba服务
1、准备环境
setenforce 0
2、安装软件包
yum -y install samba
3、修改配置文件
/etc/samba/smb.conbf #先建立共享目录 mkdir /share
4、启动服务
systemctl start smb
5、测试
samba用户必须是系统用户,登录类型为/sbin/nologin不可登录型
作业二:nginx服务
二进制安装nginx包,作为web服务修改配置文件
让配置生效,验证配置
1、准备环境
iptables –F 临时清除防火墙
systemctl stop firewalld
systemctl disable firewalld 关闭开机自启
setenforce 0
/etc/sysconfig/selinux
#SELINUX=disabled
====》part2:配置ip arping ip地址 ping通时返回ip地址
2、安装软件包
二进制方式安装
yum install epel-release -y
yum install nginx -y
源码安装
yum –y install gcc-*
yum –y install glibc-*
yum –y install pcre -y
# ./configure --prefix=/usr/local/nginx --with-pcre=/usr/lib64
./configure --prefix=/usr/local/nginx --with-http_rewrite_module
make
make install
安装完成后:
3、修改配置文件
vim /usr/local/nginx/conf/nginx.conf
#user nobody;
worker_processes 3;
4、启动服务
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ps aux | grep nginx
#/usr/local/nginx/sbin/nginx -s stop 关闭
#/usr/local/nginx/sbin/nginx -s reload 重新加载配置文件
补充:
状态码:
200 访问成功
3开头,重定向
4开头,客户端的问题
5开头,服务端的问题
5 测试
作业三:nginx反向代理三台web
1、模拟三台web服务
[root@www nginx]# vim conf/nginx.conf [root@www nginx]# vim conf/nginx.conf [root@www nginx]# mkdir -p /webserver/server1 [root@www nginx]# mkdir -p /webserver/server2 [root@www nginx]# mkdir -p /webserver/server3 [root@www nginx]# echo 'server1' > /webserver/server1/index.html [root@www nginx]# echo 'server2' > /webserver/server2/index.html [root@www nginx]# echo 'server3' > /webserver/server3/index.html [root@www nginx]# mkdir /webserver/nginx_conf [root@www nginx]# cp /usr/local/nginx/conf/nginx.conf /webserver/nginx_conf/web1.conf [root@www nginx]# cp /usr/local/nginx/conf/nginx.conf /webserver/nginx_conf/web2.conf [root@www nginx]# cp /usr/local/nginx/conf/nginx.conf /webserver/nginx_conf/web3.conf [root@www nginx]# cd /webserver/nginx_conf/ [root@www nginx_conf]# vim web1.conf [root@www nginx_conf]# vim web2.conf [root@www nginx_conf]# vim web3.conf
2、修改conf文件,以web1.conf为例
3、配置lb服务
4、重启服务:
[root@www nginx_conf]# pkill - nginx [root@www nginx_conf]# /usr/local/nginx/sbin/nginx -c /webserver/nginx_conf/lb.conf [root@www nginx_conf]# /usr/local/nginx/sbin/nginx -c /webserver/nginx_conf/web3.conf [root@www nginx_conf]# /usr/local/nginx/sbin/nginx -c /webserver/nginx_conf/web2.conf [root@www nginx_conf]# /usr/local/nginx/sbin/nginx -c /webserver/nginx_conf/web1.conf
实现基于轮询的方式调度三台web,并验证结果
实现基于权重的方式调度三台web,并验证结果
结果:
实现基于hash的方式调用三台web,并验证结果
结果:
最新文章
- SpringMVC学习系列(2) 之 经典的HelloWorld实现
- java-cef系列视频第四集:自定义协议
- salt安装zabbix
- application tips
- JavaScript生成器+随机数的使用
- C#中委托和事件
- oracle 锁表、解锁的语句
- js中常用的Math方法总结
- Python3实现简单的http server
- python函数(5):迭代器和生成器
- java快速排序详解
- 浅谈Android中的组播(多播)
- 召回率(Recall),精确率(Precision),平均正确率
- session的简单应用
- 【做题】agc016d - XOR Replace——序列置换&;环
- cvc-complex-type.3.2.2: 元素 'constructor-arg' 中不允许出现属性 'name'
- [Angularjs]cookie操作
- Confluence 6 LDAP 高级设置
- 那些我离不开的 Sketch 插件
- 读书笔记_Effective_C++_条款三十五:考虑virtual函数以外的其他选择
热门文章
- react-native ListView 封装 实现 下拉刷新/上拉加载更多
- Warning: isMounted(...) is deprecated in plain JavaScript React classes.
- HTML to PDF pechkin
- http://m2eclipse.sonatype.org/sites/m2e地址更换了
- ar命令提取.o的时候报错:is a fat file (use libtool(1) or lipo(1) and ar(1) on it)
- Oracle Golden Gate基本配置
- Argparse 命令行解析模块常用参数
- 模拟多级复选框效果--jquery
- PHP 学习内容
- 查看vnc server的日志