简体   繁体   English

在apache2上使用Python(Flask)和PHP

[英]Using Python (Flask) and PHP on apache2

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和Apache2 / MOD_Wsgi的页面,并且还希望使用PHP(称为Codiad的IDE)部署页面。 Flask as my main page ( enjay.work ) and I want Codiad to run on enjay.work/codiad Flask作为我的主页(enjay.work),我希望Codiad在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. 不幸的是,我对Apache config有了最基本的了解,根本不知道如何找到我需要的东西。

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. 现在,当我导航到enjay.work/Codiad时,将得到一个404页面。 for the php project I am adding to my site I followed these directions (loosly) 对于我要添加到我的站点的php项目,我遵循了这些指示 (松懈)

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 当我组合两个配置文件时,我只能使python正常工作,或者只能使PHP正常工作,我得到了Python页面,但是应该返回PHP的路径给了我404

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 更改PHP页面的配置以直接指向项目(在本例中为/ home / nathan / www / enjay / Codiad),然后在该配置上方为所需的网址添加一个别名

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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM