Flask的Apache虚拟主机配置



我的网站使用PHP和apache服务器,为192.168.0.1

我必须运行Python脚本,所以我为apache安装了Flask和mod_wsgi。我希望浏览192.168.0.1时它会响应网站,而浏览192.168.0.1/run时它会运行我的Python脚本。如何配置Virtualhost文件?我写了这个:

<VirtualHost *:80> 
DocumentRoot "D:webdefault"
<Directory "D:webdefault">
AllowOverride None
Options FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:codescript"
WSGIScriptAlias /run "D:codescriptconfigprocess.wsgi"
<Directory "D:codescriptconfig">
AllowOverride None
Options FollowSymLinks
Require all granted
</Directory>
</VirtualHost>

它对网站来说还可以;在此服务器上找不到请求的URL"至192.168.0.1/运行

我找到了这个解决方案:

<VirtualHost *:80>   
DocumentRoot "D:webdefault"   
<Directory "D:webdefault">
AllowOverride None
Options FollowSymLinks
Require all granted   
</Directory>
WSGIScriptAlias /run "D:codescriptconfigprocess.wsgi"   
<Directory "D:codescriptconfig">
AllowOverride None
Options FollowSymLinks
Require all granted   
</Directory> 
</VirtualHost>

希望丢失的DocumentRoot "D:codescript"不会影响Python脚本执行

相关内容

  • 没有找到相关文章

最新更新