網(wǎng)站眾籌該怎么做公眾號軟文是什么意思
內(nèi)容動態(tài),內(nèi)容通過程序的執(zhí)行結(jié)果返回。
通過編寫腳本,完成配置,實(shí)現(xiàn)訪問頁面返回Hello World。
實(shí)現(xiàn)步驟:
1、安裝python模塊
dnf install python3-mod_wsgi
?2、編寫腳本
在/var/www/cgi-bin/目錄下編寫腳本:
vim /var/www/cgi-bin/heihei.wsgi
腳本內(nèi)容如下:
def application(environ, start_response):
? ? ? ? status =?'200 OK'
????????output = b'Hello World'
????????response_headers = [('Content, 'text/plain'),('Content-Length', str(len(output)))] ????????start_response(status, response_headers)
return [output]
?3、配置文件
(1)、/etc/httpd/conf.d/目錄下的vhost.conf文件
vim /etc/httpd/conf.d/vhost.conf
?配置文件內(nèi)容如下:
<directory "/www">
allowoverride none
require all granted
</directory>
<virtualhost 192.168.229.135:80>
servername www.heihei.com
WSGIScriptAlias / /var/www/cgi-bin/heihei.wsgi
</virtualhost>
(2)、本地解析文件
?vim /etc/hosts
在文件中添加
192.168.229.135 www.heihei.com
(3)、windows的本地解析文件hosts
在文件中添加
192.168.229.135 www.heihei.com
4、重啟httpd服務(wù)
systemctl restart httpd
5、測試結(jié)果