4

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

otaviosoares
  • 566
  • 7
  • 17
  • 1
    When you tried it, what problems did you have? This is all pretty standard stuff. What didn't work? – S.Lott Sep 06 '11 at 15:38
  • I'd like to use mydomain.com/blog instead of cloud.mydomain.com/blog – otaviosoares Sep 06 '11 at 16:56
  • So, what is not working? Is the question how to get the domain name to work? I'm not clear on what problem you're having. Please **update** the question to state what's broken and what you'd like to have fixed. – S.Lott Sep 06 '11 at 17:17
  • Why can't your app just read all the data? That's the rule for browsers. Why can't your app follow those rules? – S.Lott Sep 06 '11 at 17:19

1 Answers1

7

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.

Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134
  • Sorry, I've read the example, but I still don't get what should I do. Can you please give more explicit example? Thx – goFrendiAsgard May 13 '13 at 08:34
  • 1
    Ask a new question with the specifics of your problem. Don't just ask for further explanation of a problem you are having that may be similar but that you haven't even explained so may be quite different. – Graham Dumpleton May 13 '13 at 10:21
  • Thanks for at least give attention. Here is my question http://stackoverflow.com/questions/16544055/use-bottlepy-and-php-in-the-same-computer Thanks – goFrendiAsgard May 14 '13 at 13:08