我在 Windows 10(64 位)上安裝了 WAMP Server 3.2(Apache 2.4.46),它暴露在本地公司網路中。我用它來托管普通的 php/js 應用程式。我httpd-vhosts.conf的習慣是這樣的:
<VirtualHost *:80>
ServerName RealNameOfTheServer
DocumentRoot "d:/projects"
<Directory "d:/projects/">
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
現在我得到了一個 Django 應用程式,它最好需要與其他 php 應用程式一起托管在同一臺服務器上(因為我沒有其他服務器)。我嘗試按照示例配置我的虛擬主機,但它使用了 Windows 上不可用的守護行程。
我httpd-vhosts.conf應用后的更改使 Django 應用程式正常作業,但轉儲 php/js 應用程式。
<VirtualHost *:80>
ServerName RealNameOfTheServer
DocumentRoot "d:/projects"
<Directory "d:/projects/">
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
WSGIPassAuthorization On
ErrorLog "logs/dashboard.error.log"
CustomLog "logs/dashboard.access.log" combined
WSGIScriptAlias / "d:\projects\dashboard\dashboard\wsgi_windows.py"
WSGIApplicationGroup %{GLOBAL}
<Directory "d:\projects\dashboard\dashboard">
<Files wsgi_windows.py>
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Files>
</Directory>
Alias /static "d:/projects/dashboard/static"
<Directory "d:/projects/dashboard/static">
Require all granted
</Directory>
</VirtualHost>
有沒有辦法在 Windows 上同時運行 php 和 Django 應用程式?
uj5u.com熱心網友回復:
WSGIScriptAlias / "d:\projects\dashboard\dashboard\wsgi_windows.py"
還將捕獲對“d:/projects”的呼叫-因此,如果您想避免這種情況,則需要更改為
WSGIScriptAlias /my_wsgi_app/ "d:\projects\dashboard\dashboard\wsgi_windows.py"
如果您想避免用戶看到這一點,您可以對某些路徑使用重寫規則。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/449506.html
