静态WEB
一、基于IP的自定义访问:在/www下显示信息
[root@Server html]# mkdir /www
[root@Server html]# echo this is a test > /www/index.html //编写内容
[root@Server html]# vim /etc/httpd/conf.d/vhosts.conf //编辑子配置文件如下图
[root@Server html]# systemctl restart httpd //重启服务
在浏览器中查看(linux中查看"curl http://192.168.93.139")
若要基于某个端口
二、基于域名的访问
<1>编辑主配置文件
<2>在相应目录下编写内容
[root@Server ~]# echo test > /www/t_c/index.html
<3>vim /etc/hosts
<4>重启服务并查看结果
三、加密的web
[root@Server ~]# yum install -y mod_ssl.x86_64
<1>将/etc/httpd/conf.d/ssl .conf中部分复制到/etc/httpd/conf.d/vhosts.conf下
<2>编写内容
[root@Server ~]# echo mi > /www/mi/index.html
<3>制作密钥
[root@Server ~]# cd /etc/pki/tls/certs
[root@Server ~]# make redhat.crt //输入一系列
[root@Server certs]# mv rr.key ../private //将制作好的密钥移动到对应路径
<4>重启服务
<5>测试
四、虚拟目录(别名的方式)
五、用户控制
<1>修改主配置文件
<2>设置用户的密码
<3>创建相应的目录(mkdir /a/b/c/d)
<4>编写页面显示的内容(echo no sense > /a/b/c/d)
<5>重启服务并测试
内容显示
六、web共享资源
[root@Server ~]# vim /etc/httpd/conf.d/welcome.conf //注释掉全部
[root@Server ~]# mkdir /var/www/html/share //创建共享文件或目录
[root@Server ~]# systemctl restart httpd.service //重启服务
结果
动态WEB
<1>修改配置
<2>在相应目录下写入脚本
[root@Server ~]# mkdir /var/www/alt
[root@Server ~]# vim /var/www/alt/webinfo.wsgi
<3>安装动态模块
[root@Server ~]# yum install -y mod_wsgi
<4>重启服务并测试结果