简体   繁体   中英

Is it possible to configure multiple Apache WSGIAlias'es under same VirtualHost?

I currently have an SSL configuration file in apache to serve my django project. Currently that setup looks something like:

<VirtualHost _default_:443>
#setup of paths to SSL file, default dirs, etc

#
# config for main django site
#
WSGIScriptAlias /v1 "C:/sites/mysite/v1/django.wsgi"
WSGIPassAuthorization On
<Directory "C:/sites/mysite/v1/myAppName">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

</VirtualHost>                                  

That works. However, I'd like to add a staging/test URL path (but different code directory) to the same server and reuse the existing certificate. However, if I tweak the above code and restart the server, hits to my /demo/ site are throwing an internal server error, although calls to the main django site continue to work:

<VirtualHost _default_:443>
#setup of paths to SSL file, default dirs, etc

#
# config for demo django site
#
WSGIScriptAlias /demo "C:/sites/demo/django.wsgi"
WSGIPassAuthorization On
<Directory "C:/sites/demo/myAppName">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

#
# config for main django site
#
WSGIScriptAlias /v1 "C:/sites/mysite/v1/django.wsgi"
WSGIPassAuthorization On
<Directory "C:/sites/mysite/v1/myAppName">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

</VirtualHost> 

How can I configure Apache to have two different code directories both respond depending on changes to the WSGIScriptAlias path passed on the URL?

Yes you can. Go read:

though as take heed about how to set DJANGO_SETTINGS_MODULE. You may be hitting that issue.

Do though update your question to say though what URL you are trying to access and whether you are getting an Apache 404 page or a Django one.

BTW, both of your Directory blocks are wrong as they use the wrong directory. Are these the actual configs you are using or have you doctored it to protect real values?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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