当前位置: 首页 > news >正文

【Linux深度学习笔记5.13(Apache)】

       Apache : 

1.安装yum -y install hhtpd2.启动hhtpd -k start3.停止httpd -k stop4.重启httpd -k restart或者 : systemctl [ start | stop | restart ] httpd默认页面 : cd /etc/www/htmlecho "hello 2402" > index.html验证 : 浏览器访问 : http://ip 

访问控制

vim /etc/httpd/conf/httpd.conf -------->配置文件​    denied 拒绝访问

​    默认 : 允许所有

   <Directory "/var/www/htnl">​            Options Indexes FollowSymLinks​            Require all granted​            AllowOverride  None​   </Directory>

​    拒绝某些ip访问

   <Directory "/var/www/html">​            Options Indexes FollowSymLinks​            <RequireAll>​                Require all granted​                Require not ip  10.36.178.30    10.36.178.119    ​            </RequireAll>​            AllowOverride None​   </Directory>

​    允许一部分

<Directory "/var/www/html">​            Options Indexes FollowSymLinks​            <RequireAll>​                Require ip 被拒绝的ip​            </RequireAll>​            AllowOverride None​ </Directory>

​    拒绝所有ip访问

<Directory "/var/www/html">​            Oprions Indexes FollowSymLinks​            Require all denied​            AllowOverride None​</Directory>

   虚拟主机 :

        虚拟主机:将多个网站放在一台服务器上。web服务器都可以实现。
三种:基于域名 基于端口 基于Ip(300M/9w/1y)

基于域名:


1.基于域名

[root@qfedu.com ~]# cd /etc/httpd/conf.d/
[root@qfedu.com conf.d]# vim test.conf   #创建配置文件
<VirtualHost *:80>   #指定虚拟主机端口,*代表监听本机所有ip,也可以指定ip
DocumentRoot /soso     #指定发布网站目录,自己定义
ServerName www.soso666.com  #指定域名,可以自己定义
<Directory "/soso/">AllowOverride None    #设置目录的特性,不设置目录的特性Require all granted   #允许所有人访问
</Directory>
</VirtualHost>
[root@qfedu.com ~]# mkdir /soso #创建发布目录
[root@qfedu.com ~]# mkdir /soho
[root@qfedu.com ~]# echo qianfen > /soso/index.html #创建测试页面
[root@qfedu.com ~]# echo qfedu > /soho/index.html
[root@qfedu.com ~]# systemctl restart httpd配置域名解析:在wind电脑上面打开C:\Windows\System32\drivers\etc\hosts文件。可以用管理员身份打开

2.基于端口:
  

 [root@qfedu.com ~]# vim /etc/httpd/conf/httpd.conf  ---添加[root@qfedu.com ~]# vim /etc/httpd/conf.d/test.conf<VirtualHost *:81>   #修改端口DocumentRoot /sohoServerName test.soso666.com<Directory "/soho/">AllowOverride NoneRequire all granted</Directory></VirtualHost>[root@qfedu.com ~]# systemctl restart httpd注意:域名解析并没有变

3.基于IP
 

 [root@qfedu.com ~]# ifconfig ens33:0 192.168.153.123  #添加一个临时ip[root@qfedu.com ~]# vim /etc/httpd/conf.d/test.conf<VirtualHost 192.168.153.144:80>   #指定ipDocumentRoot /soso#ServerName www.soso666.com<Directory "/soso/">AllowOverride NoneRequire all granted</Directory></VirtualHost>

http://www.lryc.cn/news/350117.html

相关文章:

  • 汇编语言入门:探索 x86 架构
  • [ffmpeg处理指令]
  • 测试之路 - 精准而优雅
  • Java基础篇常见面试问题总结
  • Spring、SpringMVC
  • 【传知代码】VRT: 关于视频修复的模型(论文复现)
  • 不用投稿邮箱,怎样向各大新闻媒体投稿?
  • NAT技术总结与双向NAT配置案例
  • mysql的explain
  • SpringBoot+Vue实现图片滑块和文字点击验证码
  • 每日复盘-20240515
  • 【Android】Apk图标的提取、相同目录下相同包名提取的不同图标apk但是提取结果相同的bug解决
  • 高校普法|基于SSM+vue的高校普法系统的设计与实现(源码+数据库+文档)
  • pytest教程-47-钩子函数-pytest_sessionfinish
  • 如何使用Python下载哔哩哔哩(Bilibili)视频字幕
  • IP代理网络协议介绍
  • 渗透相关面试+流量分析
  • Shell之高效文本处理命令
  • u3d的ab文件注意事项
  • Go微服务开源框架kratos的依赖注入关系总结
  • Linux 第三十二章
  • 手机号码的正则表达式
  • 机器学习入门介绍
  • 一文说通用户故事点数是什么?
  • GAME101-Lecture07学习
  • 【一步一步了解Java系列】:了解Java与C语言的运算符的“大同小异”
  • ICSE docker related research
  • 【C++】学习笔记——多态_1
  • C++map容器关联式容器
  • TS-抽象类和静态成员