TFTP配置备份服务器,Nginx基础web列表

目前IP电话配置文件服务器分TFTP方式传输、web方式传输,在Windows系统中使用Cisco TFTP软件和启用微软IIS网站服务;可以使用centos 7 安装TFTP、Nginx,提供TFTP和web服务。
使用Windows测试时Windows 防火墙关闭,TFTP客户端开启。
测试命令:
tftp -i 10.10.20.115 get xxxxxxx.xml C:\Users\admin\Desktop\xxxxxxx.xml
Linux测试获取web配置文件、Windows 打开IP地址,能看到配置文件
wget http://10.10.20.115/config.xxxxxxx.xml -O /root/config.xxxxxxx.xml

centos 7 环境:
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[root@localhost ~]# setenforce 0
[root@localhost ~]# sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config

1、TFTP
[root@localhost ~]# yum -y install tftp-server
[root@localhost ~]# yum install -y xinetd
[root@localhost ~]# firewall-cmd --permanent --add-service=tftp
success
[root@localhost ~]# firewall-cmd --reload
Success
[root@localhost ~]# mkdir -p /telephone_config/8001
[root@localhost ~]# vim /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /telephone_config/8001
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
[root@localhost ~]# systemctl restart xinetd
[root@localhost ~]# cd /telephone_config/8001/
[root@localhost 8001]# ls
[root@localhost 8001]# touch a.txt
Windows cmd 测试:
C:\Users\admin>tftp -i 192.168.196.134 get a.txt C:\Users\admin\Desktop\a.txt
传输成功: 1 秒 0 字节,0 字节/秒
[root@localhost ~]# tail -f /var/log/messages
Mar 4 13:46:56 localhost xinetd[9225]: START: tftp pid=9508 from=192.168.196.1
Mar 4 13:46:56 localhost in.tftpd[9509]: Client 192.168.196.1 finished a.txt

2、web
[root@localhost ~]# vim /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[root@localhost ~]# yum -y install nginx

[root@localhost ~]# firewall-cmd --permanent --add-service=http
success
[root@localhost ~]# firewall-cmd --reload
[root@localhost ~]# systemctl enable nginx.service

[root@localhost ~]# mkdir -p /telephone_config/8008
[root@localhost ~]# cd /etc/nginx/conf.d/
[root@localhost conf.d]# mv default.conf default.conf.bak
[root@localhost conf.d]# vim telephone.conf
server {
listen 80;
server_name localhost;
location / {
root /telephone_config/8008;
index index.html index.htm;
autoindex on;
charset utf-8,gbk;
autoindex_exact_size off;
autoindex_localtime on;
}
}
[root@localhost conf.d]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

[root@localhost ~]# systemctl enable nginx.service
[root@localhost ~]# systemctl restart nginx.service
[root@localhost ~]# cd /telephone_config/8008/
[root@localhost 8008]# touch {c..f}.txt
[root@localhost 8008]# ls
c.txt d.txt e.txt f.txt
[root@localhost ~]# tail /var/log/nginx/access.log
192.168.196.1 - - [04/Mar/2020:13:49:54 +0800] "GET / HTTP/1.1" 200 539 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" "-"
192.168.196.1 - - [04/Mar/2020:13:49:55 +0800] "GET /favicon.ico HTTP/1.1" 404 555 "http://192.168.196.134/" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" "-"
[root@localhost ~]#

用wget测试:
[root@localhost ~]# yum -y install wget
[root@localhost ~]# wget http://192.168.196.134/e.txt -O /root/e.txt
[root@localhost ~]# tail /var/log/nginx/access.log
192.168.196.134 - - [04/Mar/2020:13:56:06 +0800] "GET /e.txt HTTP/1.1" 200 0 "-" "Wget/1.14 (linux-gnu)" "-"
[root@localhost ~]# ls
anaconda-ks.cfg e.txt

猜你喜欢

转载自www.cnblogs.com/Ant-Hanks/p/12434494.html
今日推荐