Linux专项之Apache

1.虚拟机上网
1.安装软件(httpd)
yum search httpd

yum install -y httpd
2.关闭防火墙
[root@localhost ~]# systemctl stop firewalld.service
3.selinux
[root@localhost ~]# vim /etc/selinux/config
                SELINUX=disabled
[root@localhost ~]# setenforce 0   //临时关闭selinux
4.启动服务
[root@localhost ~]# systemctl restart httpd
5.验证
[root@localhost ~]# firefox &
问题:
1.首页文件叫什么名字?
2.首页文件存放的位置
3.看一看?在哪里看?

1.找出apache配置文件路径
[root@localhost ~]# rpm -ql httpd | grep conf
[root@localhost ~]# vim /etc/httpd/conf/httpd.conf  (没有任何修改)
119 DocumentRoot "/var/www/html"
164     DirectoryIndex index.html
2.编写首页文件内容
[root@localhost ~]# vim /var/www/html/index.html
或者
[root@localhost ~]# echo "happy new year" > /var/www/html/index.html
[root@localhost ~]# vim /etc/httpd/conf/httpd.conf

165     DirectoryIndex test.html
166     #DirectoryIndex index.html

119 DocumentRoot "/test"
120 #DocumentRoot "/var/www/html"

132
133 #

[root@localhost ~]# systemctl restart httpd

实验四:修改端口号(8088)

[root@localhost ~]# vim /etc/httpd/conf/httpd.conf
 42 Listen 8088
 43 #Listen 80

实验五:用主机名访问

做临时解析
linux:
[root@localhost ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.134 www.qq1.com

windows:
C:\Windows\System32\drivers\etc\hosts
192.168.1.134 www.qq1.com

实验六:虚拟主机

实验七:用https访问网站

实验八:动态页面

1.环境配置好:网络、yum
2.完成一个实验
自定义首页文件路径为:/qwer/qaz
自定义首页文件名称:qq.qz
指定端口号为9000

Original: https://www.cnblogs.com/gaoziman/p/15863142.html
Author: 爱笑的Gao
Title: Linux专项之Apache

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/609717/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

  • 第二周作业

    第二周作业 一、显示在/etc目录下,以非字母开头,后面跟了一个字母以及其它任意长度任意字符的文件或者目录 [root@CentOS8 / ]#!mkdir mkdir /etc/…

    Linux 2023年6月13日
    099
  • 【实操填坑】在树莓派上编译 EtherCAT IgH Master 主站程序

    官网下载地址:https://etherlab.org/download/ethercat/ (可list查看文件列表)https://etherlab.org/download/…

    Linux 2023年6月7日
    0130
  • python递归查找文件目录

    1 # -*- coding:utf-8 -*- 2 3 import os 4 5 allfile = [] 6 def get_all_file(path): 7   allf…

    Linux 2023年6月6日
    089
  • 如何优化前端性能?

    导读:随着前端的范畴逐渐扩大,深度逐渐下沉,富前端必然带来的一个问题就是性能。特别是在大型复杂项目中,重前端业务可能因为一个小小的数据依赖,导致整个页面卡顿甚至崩溃。本文基于Qui…

    Linux 2023年6月8日
    0119
  • 无线配置多一个路由器作为家庭wifi的无线热点?

    以下内容为本人的著作,如需要转载,请声明原文链接微信公众号「englyf」 https://mp.weixin.qq.com/s/8OcDnY3O6ux41GntesHHcg 手头…

    Linux 2023年6月6日
    0118
  • PowerShell yarn : 无法加载文件 C:UsersAdminAppDataRoamingnpmyarn.ps1,因为在此系统因为在此系统上禁止运行脚本。

    1、搜索powershell,右键以管理员身份运行 2、若要在本地计算机上运行您编写的未签名脚本和来自其他用户的签名脚本,请使用以下命令将计算机上的 执行策略更改为 RemoteS…

    Linux 2023年5月28日
    0116
  • 超好用的UnixLinux 命令技巧 大神为你详细解读

    1、删除一个大文件 我在生产服务器上有一个很大的200GB的日志文件需要删除。我的rm和ls命令已经崩溃,我担心这是由于巨大的磁盘IO造成的,要删除这个大文件,输入: > /…

    Linux 2023年6月14日
    0111
  • 常用命-sar

    作者:Outsrkem原文链接:https://www.cnblogs.com/outsrkem/p/14725402.html本文版权归作者所有,欢迎转载,但未经作者同意必须保留…

    Linux 2023年6月6日
    093
  • Redis-Sentinel Redis的哨兵模式

    Redis-Sentinel Redis的哨兵模式Redis Sentinel 模式简介Redis-Sentinel是官方推荐的高可用解决方案,当redis在做master-sla…

    Linux 2023年5月28日
    099
  • mysql join语句的执行流程是怎么样的

    mysql join语句的执行流程是怎么样的 join语句是使用十分频繁的sql语句,同样结果的join语句,写法不同会有非常大的性能差距。 select * from t1 st…

    Linux 2023年6月8日
    0104
  • Java的jinfo命令使用详解

    jinfo命令简介 jinfo(Java Virtual Machine Configuration Information)是JDK提供的一个可以实时查看Java虚拟机各种配置参…

    Linux 2023年5月27日
    0117
  • Linux 查看端口被占用

    端口被占用网上很多,这种频繁操作的命令容易忘记,写这边文章的目的主要是加深操作命令的印象, Liux 查看端口占用情况可以使用 lsof 和 netstat 命令。 lsof ls…

    Linux 2023年6月6日
    092
  • redis重点是 dir 的默认配置一定要改

    find / -name dump.rdb 发现有两个dump文件,这两个文件目录不一致,问题在于 redis.conf 文件属性dir,默认配置是dir ./ 表示在哪启动ser…

    Linux 2023年5月28日
    089
  • 个人学习-STL深入学习01-vectory源码研习 // 需要补充

    STL,即标准模板库(Standard Template Library,STL),内部封装了常见的容器和算法。由六部分组成:1.容器(Containers)2.分配器(Alloc…

    Linux 2023年6月6日
    094
  • 正则表达式

    1.正则表达式分类 正则表达式:REGEXP,REGular EXPression。正则表达式分为两类: Basic REGEXP(基本正则表达式) Extended REGEXP…

    Linux 2023年6月6日
    0104
  • Mysql实战技能全解

    一、数据库原理 1 数据的分类 结构化的数据:即有固定格式和有限长度的数据。例如填的表格就是结构化的数据,国籍:中华人民共和国,民族:汉,性别:男,这都叫结构化数据 非结构化的数据…

    Linux 2023年6月7日
    0148
亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球