Apache mod_wsgi and php in the same domain

半世苍凉 提交于 2019-12-10 20:28:05

问题


is it possible to make my webserver run python and php in the same domain?

I have a website in python/django that is www.mydomain.com.

Now, i have to host a blog in www.mydomain.com/blog in wordpress.

Can i make it through?

Apache 2.2 mod_wsgi

My config now:

# RUNS PYTHON
<VirtualHost *:80>
    DocumentRoot /home/padrao
    ErrorLog /home/padrao/logs/mydomain.com-error_log
    CustomLog /home/padrao/logs/mydomain.com-access_log common
    WSGIScriptAlias / /home/padrao/mywebsite.wsgi
</VirtualHost>

# RUNS PHP
<VirtualHost *:80>
    ServerName cloud.mydomain.com
    ServerAdmin postmaster@mydomain.com
    DocumentRoot /home/padrao/www
    ErrorLog logs/mydomain.com-error_log
    CustomLog logs/mydomain.com-access_log combined

    <Directory /home/padrao/www>
      php_admin_value open_basedir "/home/padrao/www"
      php_admin_value upload_tmp_dir "/tmp"
    </Directory>

</VirtualHost>

Thanks


回答1:


They should be defined in the one VirtualHost, not two separate ones.

An Alias directive then needs to be defined for subdir PHP application is at. This will override WSGIScriptAlias for the sub URL.

Alternatively you need to use methods outlined in:

http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive

whereby stuff will be mapped to file system based resource and if not will as fallback be routed to WSGI application.



来源:https://stackoverflow.com/questions/7322336/apache-mod-wsgi-and-php-in-the-same-domain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!