域名访问,wget,curl,scp

域名访问流程:1. 访问hosts(主机),查看本地DNS缓存,有则直接访问2. 本地无缓存,则查看localDNS(/etc/resolv.conf文件,或IP配置文件)3. 在查看权威DNS,获取域名对应ipApache相关配置:(1):虚拟主机环境:test1主机 IP:192.168.10.11;test2主机 IP:192.168.10.12 配置文件:/etc/httpd/conf/httpd.conf准备(test1,test2):yum install http
摘要由CSDN通过智能技术生成

域名访问流程:

1. 访问hosts(主机),查看本地DNS缓存,有则直接访问
2. 本地无缓存,则查看localDNS(/etc/resolv.conf文件,或IP配置文件)
3. 在查看权威DNS,获取域名对应ip

Apache相关配置


(1):虚拟主机
环境:test1主机 IP:192.168.10.11;test2主机 IP:192.168.10.12
配置文件:/etc/httpd/conf/httpd.conf

准备(test1,test2):
yum install httpd -y
systemctl start httpd
[root@test1 ~]# vim /etc/httpd/conf/httpd.conf   #插入下面此信息
...
 80 <VirtualHost *:80>
 81 DocumentROOT /var/www/test   	#配置文件目录
 82 serverNAME www.test.com			#配置的域名
 83 </VirtualHost>
...
[root@test1 test]# systemctl restart httpd
[root@test1 ~]# cd /var/www/
[root@test1 www]# mkdir test
[root@test1 www]# cd test/
[root@test1 test]# vim index.html
  1 This is a test of test!
#测试:
[root@test2 ~]# curl 192.168.10.11
This is a test of test!
[root@test2 ~]# curl www.test.com
^C
#注:此时需要在test2上面添加下面信息
[root@test2 ~]# vim /etc/hosts
 3 192.168.10.11 www.test.com
 #测试
[root@test2 ~]# curl www.test.com
This is a test of test!

#用主机测试
在这里插入图片描述
在这里插入图片描述
此时需要配置主机文件,因为主机不能解析域名信息
配置文件为:C:\Windows\System32\drivers\etc\hosts
在这里插入图片描述
测试:
在这里插入图片描述
(2)apache的页面认证
配置:

[root@test1 test]# vim /etc/httpd/conf/httpd.conf 	#插入以下几行
117 <Directory /var/www/>
118     Options None
119     AllowOverride none
120     Order allow,deny
121     Allow from all
122     AuthName "please input username && passwd.."
123     AuthType Basic
124     AuthUserFile /usr/local/httpd/conf/passwd
125     require valid-user
126    # Require all denied
127 </Directory>
[root@test1 test]# systemctl restart httpd
[root@test1 test]# vim /var/local/httpd/conf/passwd
[root@test1 test]# mkdir -p /var/local/httpd/conf/
[root@test1 test]# touch /var/local/httpd/conf/passwd
[root@test1 test]# htpasswd -c /usr/local/httpd/conf/passwd 123
New password:
Re-type new password:
Adding password for user 123
#验证
[root@test2 ~]# curl -user=123 www.test.com
Enter host password for user 'ser=123':
This is a test of test!

wget

启动:
	-b :转入后台
日志和输出文件:
	-o file :将日志信息写入file文件
	-a file :追加
	-q 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值