一、创建包含用户名和密码的文本文件(htpasswd)
(一)、创建账号和密码:
htpasswd -c /etc/httpd/zhanghao hao
htpasswd -c /etc/httpd/zhanghao mei
二、创建验证账号的目录
- mkdir /user/local/mysecret/
- echo this is mysecret > /user/local/mysecret/index.html
三、虚拟服务器的主配置文件配置
(之前的全部配置请见基于不同主机名的虚拟主机配置一文)
- 重启httpd服务
- 输入账号密码即可访问页面(见上图,实验完成)
一、安装python模块
(一)、先挂载在安装python包
- mount /sr0 /mnt
- dnf install python3-mod_wsgi -y
(二)、查看动态页面的内容,配置脚本内容
- 进入文件配置 vim /var/www/cgi-bin/hello.wsgi
def application(environ, start_response):
status = '200 OK'
output = b'Hello World'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
二、配置主配置文件内容
- vim vhost.conf
重启httpd服务
- systemctl restart httpd
完成实验(如图)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)