问题
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