1.安装python模块
dnf install python3-mod_wsgi -y
2.添加脚本
vim /var/www/cgi-bin/helloworld.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]
3.添加配置文件内容
配置文件:vim /etc/httpd/conf.d/vhost.conf
<virtualhost 192.168.233.139:80>
servername www.haha.com
WSGIScriptAlias / /var/www/cgi-bin/helloworld.wsgi
</virtualhost>
4.域名映射
vim /etc/hosts
192.168.233.139 www.haha.com
5.重启服务
systemctl restart httpd
6.访问内容
curl http://www.haha.com