mod_wsgi
模組。
[root@kvm5 ~]# yum install mod_wsgi -y
[root@kvm5 ~]# vim /etc/httpd/conf/httpd.conf [root@kvm5 ~]# grep ^Listen /etc/httpd/conf/httpd.conf Listen 80 Listen 8989 [root@kvm5 ~]# tail -10 /etc/httpd/conf/httpd.conf IncludeOptional conf.d/*.conf <Virtualhost *:80> Documentroot /var/www/html Servername kvm5.deyu.wang </Virtualhost> <Virtualhost *:8989> Documentroot /var/www/html Servername dynamic5.deyu.wang WSGIScriptAlias / /var/www/html/webapp.wsgi </Virtualhost>
[root@kvm5 ~]# firewall-cmd --permanent --zone=public --add-port=8989/tcp success [root@kvm5 ~]# firewall-cmd --reload success
http_port_t
,在 SELinux 啟動的情況下,不執行此動作則無法正常啟動 httpd 服務。
[root@kvm5 ~]# semanage port -a -t http_port_t -p tcp 8989
[root@kvm5 ~]# systemctl reload httpd.service
[root@kvm5 ~]# wget http://dywang.csie.cyut.edu.tw/materials/webapp.wsgi \ -O /var/www/html/webapp.wsgi
[root@kvm5 ~]# curl http://dynamic5.deyu.wang:8989/ Content generated for: 192.168.122.5 (deyu.wang) [root@kvm5 ~]#
[root@kvm7 ~]# curl http://dynamic5.deyu.wang:8989/ Content generated for: 192.168.122.7 (deyu.wang) [root@kvm7 ~]#