鹅鹅根据相关要求搭建

临时关闭防火墙和selinux

[root@localhost etc]# systemctl stop firewalld
[root@localhost etc]# setenforce 0

一 练习题

1.搭建web服务器,访问到 "小胖,你咋这么胖"

/etc/httpd/conf.d     子配置目录(自定义的配置文件)

在vim etc/httpd/conf.d/fhosts.d 进行配置

<virtualHost 192.168.171.129>DocumentRoot "/fast/129"ServerName 192.168.171.129
</virtualHost><Directory /fast>AllowOverride noneRequire all granter
</Directory> mkdir /fast/129
echo 小胖,你咋这么胖 > /fast/129/index.html
systemctl restart httpd

访问成功了!!!

2.创建基于域名的的虚拟主机

继续在原配置中做修改ewe1e1

<virtualHost 192.168.171.129>DocumentRoot "/xiaopang"ServerName www.xiaopang.com
</virtualHost><virtualHost 192.168.171.129>DocumentRoot "/dapang"ServerName www.dapangpang.com
</virtualHost><Directory /xiaopang>AllowOverride noneRequire all granted
</Directory><Directory /dapang>AllowOverride noneRequire all granted
</Directory>mkdir /xiaopangmkdir /dapangecho  i am big fat > /dapang/index.htmlecho  i am small fat > /dapang/index.html
systemctl  restart httpd

注意:域名访问需要在文件下面注册

 成功了!!

3.创建虚拟目录

<virtualHost 192.168.171.129>DocumentRoot "/xiaopang"Alias /x     /xiaopang/129ServerName 192.168.171.129
</virtualHost>
<Directory>AllowOverride noneRequire all granted
</Directory>mkdir /xiaopang/129
echo i am 129 > /xiaopang/129/index.html
systemctl restart httpd

成功访问!!!!

4.创建虚拟网络,允许abc和xyz访问

<v<virtualHost 192.168.171.129>DocumentRoot "/xiaopang"Alias /x     /xiaopang/129ServerName 192.168.171.129
</virtualHost>
<Directory /xiaopang>AllowOverride noneRequire all granted
</Directory>
<Directory /xiaopang/129>AuthType BasicAuthName "please login:"AuthuserFile /etc/httpd/userfileRequire user abc xyz
</Directory>

成功了!!

5.真题

<virtualHost 192.168.171.129>DocumentRoot "/xiaopang"Alias /student     /xiaopang/studentAlias /data        /xiaopang/dataAlias /moeny       /xiaopang/moneyServerName 192.168.171.129
</virtualHost>
<Directory /xiaopang>AllowOverride noneRequire all granted
</Directory>
<Directory /xiaopang/student>AuthType BasicAuthName "please login:"AuthuserFile /etc/httpd/userfileRequire user song tian
</Directory><VirtualHost 192.168.171.129>DocumentRoot "/xiaopang/money"ServerName 192.168.171.129SSLEngine onSSLCertificateFIle    /etc/pki/tls/certs/openlab.crtSSLCertificateKeyFile /etc/pki/tls/private/openlab.key
</Virtualhost>

设置song和tian的密码

htpasswd -c /etc/httpd/userfile song
Adding password for user song
htpasswd -c /etc/httpd/userfile tian
Adding password for user tian

添加用户数据

 echo this is a stydent! > /xiaopang/student/index.htmlecho this is a data! > /xiaopang/data/index.htmlecho this is money! > /xiaopang/money/index.html

搭建https加密

cd /etc/pki/tls/certsopenssl req -newkey rsa:4096 -nodes -sha256 -keyout ../private/openlab.key  -x509 -days 365 -out openlab.crt

linux搭建web服务相关推荐

  1. 使用Linux搭建web服务器

    对于一个网站开发者而言,在经历了艰难的开发过程后,要将网站推向给用户,必须要做的一步便是部署我们的web应用,这样广大的用户才能成功访问我们的网站.目前主流的部署平台都是基于Linux的.本文将详细讲 ...

  2. 使用 docker 搭建 web 服务环境

    本文目的 做过开发的人对开发环境的安装.配置应该都不会太陌生,不管你做什么开发,对开发环境都会具有一定的依赖性的.对于 PHP 的 Web 开发来说,开发环境至少要有一个 Web 服务器(如 Apac ...

  3. 新手如何使用docker搭建web服务环境

    做过开发的人对开发环境的安装.配置应该都不会太陌生,不管你做什么开发,对开发环境都会具有一定的依赖性的.对于 PHP 的 Web 开发来说,开发环境至少要有一个 Web 服务器(如 Apache.Ng ...

  4. linux 单机安装yum,Linux搭建Nacos服务(单机版)

    Linux搭建Nacos服务(单机版) 1.下载Nacos安装包 2.安装JDK 3.解压文件 4.启动nacos 5.服务注册&发现和配置管理 6.停止服务 7.开启nacos持久化 8.重 ...

  5. 普歌-腾讯云短信+使用node发送短信(3种方法API、SDK)、封装工具、搭建web服务、写接口、调用接口发送短信、时效性判断、验证验证码的正确性(下)

    普歌-结合腾讯云短信服务+node搭建一个简单的发送短信web小项目 涉及技术: 腾讯云服务 后端服务:node+express 前端搭建:html+js 前言:本来这篇博客应该很早就发了,中间有一些 ...

  6. tomcat搭建web服务,lrc文件下载

    对于我这个开始学.net的人来说,对tomcat所知甚少.如今在Android练习中,需要用tomcat搭建web服务,并提供文件下载.视频中老师一带而过,我那个郁闷啊.没有办法,自己倒持一下,写这篇 ...

  7. RHEL 5服务篇—使用Apache搭建Web服务(一)

    安装Apache服务以及了解相关的配置文件 在当今的互联网中常用的搭建web服务器的方法有两种,一种是IIS.一种是Apache.大家都知道IIS是微软的产品,只支持在windows系统上使用.那么我 ...

  8. linux搭建web服务器原理,【LINUX】linux搭建web服务器

    linux httpd 假设服务器地址为192.168.80.20/241.将准备安装的httpd软件包共享给everyone, (1)在linux上mount.cifs  //真机IP地址/共享文件 ...

  9. Linux搭建web网站综合实验

    综合练习:请给openlab搭建web网站 网站需求: 1.基于域名[www.openlab.com](http://www.openlab.com)可以访问网站内容为 welcome to open ...

最新文章

  1. 通过sessionid获取session php,php如何返回sessionID和如何通过sessionID获取相关的session...
  2. python的填充色怎么弄_python中如何给图形填充颜色
  3. Cucumber 入门一
  4. idea输入法候选区不跟随光标
  5. param注解报错_mybatis不加@Parm注解报错的解决方案
  6. 阿里云李飞飞:今年将帮1000家企业“去O”,完成10000套传统数据仓库上云
  7. 如何能include外键对应的表?向博客园的兄弟请教!
  8. 数据库dba_DBA延伸数据库指南
  9. 使用win10 hyper-v安装linux系统
  10. 方程根求解数值方法matlab实现二分法、牛顿法、斜截法,代码程序,手写思路,理论分析,最基本的操作
  11. java中html网页转化成pdf(itext)
  12. 链表排序python
  13. Word,标题2,2.1,编号,多级编号,样式-Word中二级标题实现2.1多级编号解决方法!!!
  14. 医疗知识图谱_寻医问药
  15. Arch LinuxLinux引导教程 2021.7.22
  16. Result类的写法
  17. html 链接nofollow,ueditor给超链接默认添加rel=nofollow标签
  18. 微信小程序后台销毁时间 演变和总结(热启动时间限制)
  19. Jetty容器SSL证书的安装
  20. 搭建网站的主要目的、基本步骤和技巧

热门文章

  1. PS打不开php,ps卡住了没保存怎么办?
  2. python数据分析实训心得_Python代码在实践过程中的经验总结
  3. mysql中防呆是什么_别让用户发呆——设计中的防呆策略
  4. 傲慢与偏见:程序员非科班出身就得不到重用?
  5. 华为机试真题 Java 实现【开心消消乐】【2022.11 Q4 新题】
  6. 《Datawhale推荐系统教程》来了!
  7. 阿里云oss文件上传(简单上传、服务端签名后直传)
  8. 5-2 图书价格汇总
  9. 抖音SEO优化源码,企业号搜索排名系统,矩阵分发。
  10. MPU6050配置低功耗和中断