在apache2上使用Python(Flask)和PHP

I am running a page based on Flask and Apache2/MOD_Wsgi and am wanting to also deploy a page using PHP (a IDE called Codiad). Flask as my main page ( enjay.work ) and I want Codiad to run on enjay.work/codiad

Unfortunately I have the most basic understanding of Apache config and don't know at all how to find what I need.

Here is what I have so far:

<virtualhost *:80>
    ServerName enjay.work
    DocumentRoot /home/nathan/www/enjay

WSGIDaemonProcess enjay user=nathan group=www-data threads=5 home=/home/nathan/www
WSGIScriptAlias / /home/nathan/www/enjay/enjay.wsgi
<Directory /Codiad>
    Options indexes FollowSymlinks MultiViews
    AllowOverride All
    Require all granted
    Allow from all
</Directory>

<Directory />
    WSGIProcessGroup enjay
    WSGIApplicationGroup %{GLOBAL}
    WSGIScriptReloading On

    Require all granted
</Directory>

</virtualhost>

now when I navigate to enjay.work/Codiad I get a 404 page. for the php project I am adding to my site I followed these directions (loosly)

I can get just the python to work, or just the PHP to work, when I combine the two Config files I get the Python page but the path that should return the PHP gives me a 404

2个回答

Change the configuration for your PHP page to point directly at the project (in this case /home/nathan/www/enjay/Codiad) then above that configuration add an alias for the web address you want

Alias /Codiad "/home/nathan/www/enjay/Codiad"
<Directory /home/nathan/www/enjay/Codiad>
**Existing Config**
</Directory>

I think it should be like this.

<Directory /home/nathan/www/enjay>
    Options indexes FollowSymlinks MultiViews
    AllowOverride All
    Require all granted
    Allow from all
</Directory>
dqitk20644
dqitk20644 是的,在我的配置中我设置了文档根,因此我可以将其引用为/
接近 4 年之前 回复
duannuci4008
duannuci4008 如何用'/'相对引用它,这意味着根目录。
接近 4 年之前 回复
dongzhansong5785
dongzhansong5785 没有设置'DocumentRoot / home / nathan / www / enjay'这样我可以相对引用它吗? 来源@MEX
接近 4 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐