Linux专项之Apache
发布时间:2022-08-09 10:44:33 所属栏目:Linux 来源:互联网
导读:前期准备 1.虚拟机上网 实验一:展示默认页面 1.安装软件(httpd)yum search httpd yum install -y httpd2.关闭防火墙[root@localhost ~]# systemctl stop firewalld.service 3.selinux[root@localhost ~]# vim /etc/selinux/config SELINUX=disabled[root@
前期准备 1.虚拟机上网 实验一:展示默认页面 1.安装软件(httpd)yum search httpd yum install -y httpd2.关闭防火墙[root@localhost ~]# systemctl stop firewalld.service 3.selinux[root@localhost ~]# vim /etc/selinux/config SELINUX=disabled[root@localhost ~]# setenforce 0 //临时关闭selinux4.启动服务[root@localhost ~]# systemctl restart httpd5.验证[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.html2.编写首页文件内容[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.html166 #DirectoryIndex index.html 119 DocumentRoot "/test"120 #DocumentRoot "/var/www/html" 132 <Directory "/test">133 #<Directory "/var/www/html"> [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/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.1.134 www.qq1.com windows:C:WindowsSystem32driversetchosts192.168.1.134 www.qq1.com 实验六:虚拟主机 实验七:用https访问网站 实验八:动态页面 作业 1.环境配置好:网络、yum 2.完成一个实验自定义首页文件路径为:/qwer/qaz自定义首页文件名称 (编辑:长春站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |