It is hard to give advice given you haven't shown what revised configuration you were using when trying to use the Alias directive. Would have to mostly guess what you were trying.
In short though, especially if you are trying to stick static assets for both at the root of the site, simply use different sub URLs for each sites static assets. Even better, since you are mounting the web applications themselves at a sub URL, use a sub URL of the mount point for each site for the static assets. For example: WSGIScriptAlias /irwin/ /var/www/irwin/vorac-site/ Alias /irwin/static/ /var/www/irwin/vorac-site/ WSGIScriptAlias /stephanopoulos/ /var/www/stephanopoulos/vorac-site/ Alias /stephanopoulos/static/ /var/www/stephanopoulos/vorac-site/ The Alias directive takes precedence over the WSGIScriptAlias for those sub URLs. Your web application should then make sure it uses relative URLs to access static assets, or properly do URL reconstruction for embedded URLs which takes into consider the web application mount point: http://www.python.org/dev/peps/pep-3333/#url-reconstruction Any decent web framework will provide some inbuilt function or template tag for reconstructing URLs for other URLs in the site properly so that the mount point doesn't have to be hardwired into your application code. Graham On 12/02/2014, at 5:52 PM, J_Irwin13 <[email protected]> wrote: > Hello Graham, > > Thank you for your reply. You have suggested that I could use Alias > directives to selectively overlay static assets required for other sites. > I tried to use the Alias directive, but then this will force the two wsgi > apps to use the same static file folder. Would you please elaborate to me > what you mean by 'selectively overlay static assets'? I am having a hard time > understanding how this is achievable by the Alias directive. > > > On Tuesday, February 11, 2014 3:55:14 PM UTC-6, Graham Dumpleton wrote: > You can't have more than one DocumentRoot directive inside of a VirtualHost. > If you do only the last one is used. The results are not merged. > > You would have to choose only one to use and then use Alias directives to > selectively overlay static assets required for other sites. The alternative > is to use a cascading set of mod_rewrite rules to allow static assets from > multiple directories to be merged. > > For further ideas see: > > http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#Hosting_Of_Static_Files > http://stackoverflow.com/questions/4679258/merging-two-folder-with-mod-rewrite-in-htaccess > http://serverfault.com/questions/69938/how-can-i-make-apache-look-in-2-separate-directories-with-one-common-url > > You will of course need to adapt any rewrite rules to your specific needs. > > Graham > > On 12/02/2014, at 8:12 AM, J_Irwin13 <[email protected]> wrote: > >> Hi all, >> >> I am currently working on a cherrypy project on a remote server with Apache >> with mod_wsgi installed. >> I have already been working on a wsgi application on this server and am >> trying to add another one. >> In order to add a new wsgi application, I have made a small change to the >> server Apache config file: >> >> <VirtualHost *:80> >> ServerAdmin webmaster@localhost >> ServerAlias mtron.dyndns.org >> DocumentRoot /var/www >> <Directory /> >> Options FollowSymLinks >> AllowOverride None >> </Directory> >> <Directory /var/www/> >> Options Indexes FollowSymLinks MultiViews >> AllowOverride All >> Order allow,deny >> allow from all >> </Directory> >> >> DocumentRoot /var/www/irwin/vorac-site/ >> <Directory /var/www/irwin/vorac-site/> >> Options Indexes FollowSymLinks MultiViews >> AllowOverride All >> Order allow,deny >> Allow from all >> </Directory> >> WSGIScriptAlias /irwin/ /var/www/irwin/vorac-site/ >> >> DocumentRoot /var/www/stephanopoulos/vorac-site/ >> <Directory /var/www/stephanopoulos/vorac-site/> >> Options Indexes FollowSymLinks MultiViews >> AllowOverride All >> Order allow,deny >> Allow from all >> </Directory> >> WSGIScriptAlias /stephanopoulos/ /var/www/stephanopoulos/vorac-site/ >> >> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ >> <Directory "/usr/lib/cgi-bin"> >> AllowOverride None >> Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch >> Order allow,deny >> Allow from all >> </Directory> >> >> ErrorLog ${APACHE_LOG_DIR}/error.log >> >> # Possible values include: debug, info, notice, warn, error, crit, >> # alert, emerg. >> LogLevel warn >> >> CustomLog ${APACHE_LOG_DIR}/access.log combined >> >> Alias /doc/ "/usr/share/doc/" >> <Directory "/usr/share/doc/"> >> Options Indexes MultiViews FollowSymLinks >> AllowOverride None >> Order deny,allow >> Deny from all >> Allow from 127.0.0.0/255.0.0.0 ::1/128 >> </Directory> >> </VirtualHost> >> >> The wsgi app i have been working on is colored in green and located on >> /var/www/irwin/vorac-site/ on the server. >> The new wsgi app that I added is colored in blue and located on >> /var/www/stephanopoulos/vorac-site/ on the server. >> >> As you can see, the applications are located in different subfolders of >> /var/www. In both folders, there is a folder called 'public' >> that contains a folder called 'js' for javascript files. >> >> When I tried opening the new app in my browser, I did not notice anything at >> first (The new app is a fork of the other app) >> The problem is that when I add new javascript files or changes to my old app >> (/var/www/irwin/vorac-site/), any changes I make >> seem to be ignored. After doing a few experiments, I realized that the old >> app was looking for javascripts in the directory of the new >> app. The following apache log message seems to support this: >> >> [Tue Feb 11 00:46:23 2014] [error] [client 62.251.63.200] File does not >> exist: /var/www/stephanopolous/vorac-site/public/js/pos_lib.js, referer: >> http://mtron.dyndns.org/irwin/index >> >> Where pos_lib.js is a new javascript file I had added to >> /var/www/irwin/vorac-site/public/js. >> >> Furthermore, I have temporarily added another line after the new additions: >> >> Alias /public /var/www/irwin/vorac-site/public >> >> Now the js files are properly updated for the irwin site, but the same >> updates are obviously applied to the stephanopolous site, which is not what >> I need. >> I need the server to be configured such that the apps will only look for >> static files such as javascript files in their respective 'public' folders, >> not sharing any resources. >> >> I have tried to look for similar situations on this newsgroup and on >> stackoverflow, but have had no luck doing so. My guess as to what is wrong >> is that since >> WSGIScriptAlias /stephanopoulos/ /var/www/stephanopoulos/vorac-site/ was >> added last, it made it so that all wsgi apps will look for static >> files in this folder. Can anyone help me solve this problem? >> >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "modwsgi" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/modwsgi. >> For more options, visit https://groups.google.com/groups/opt_out. > > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/modwsgi. > For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/modwsgi. For more options, visit https://groups.google.com/groups/opt_out.
