Re: [modwsgi] RHEL: Apache, mod_wsgi daemon - Multiple Virtual Hosts defined but it always picks up the first one

2021-07-08 Thread Graham Dumpleton
You aren't defining a VirtualHost for port 443 for app2.com .

In the app1.com  you have VirtualHost for both port 80 and 
443 with port 80 redirecting to 443.

You would need similar arrangement for app2.com .

Graham

> On 8 Jul 2021, at 8:24 pm, Amber L  wrote:
> 
> Hi, 
> 
> I also have a similar problem. I have two flask apps with separate domains 
> but only the first is working properly. HTTPS only applies in the first 
> domain app1.com . Below is the conf file. 
> 
> Any ideas on what I may be doing wrong? 
> 
> 
> #  app1. com
> 
> 
> ServerName app1.com 
> ServerAlias  app1.com  *. app1.com 
> ServerAdmin em...@example.com 
> 
># WSGI Settings
> WSGIDaemonProcess  app1 user=apache threads=7 
> python-home=/var/www/app1/venv
> WSGIScriptAlias / /var/www/app1/wsgi.py process-group= app1 
> application-group=%{GLOBAL}
> WSGIScriptReloading On
> 
># Tell Apache where your app's code directory is
> DocumentRoot /var/www/app1
>
># Logging 
>ErrorLog /var/www/app1/logs/app.log
>CustomLog /var/www/app1/logs/access.log combined
>LogLevel info ssl:warn
> 
># Relax Apache security settings
>
>  
>Allow from all
>Options -MultiViews
>Require all granted
>  
>
> 
>Alias /static /var/www/app1/application/static
>
>  Allow from all 
>  Options -MultiViews
>  Require all granted
>
> 
> 
> RewriteEngine on
> RewriteCond %{SERVER_NAME} = app1.com  [OR]
> RewriteCond %{SERVER_NAME} =*. app1.com 
> RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} 
>  [END,NE,R=permanent]
> SSLEngine on
> SSLCertificateFile /etc/letsencrypt/live/app1.com/cert.pem 
> 
> SSLCertificateKeyFile /etc/letsencrypt/live/app1.com/privkey.pem 
> 
> Include /etc/letsencrypt/options-ssl-apache.conf
> SSLCertificateChainFile /etc/letsencrypt/live/app1.com/chain.pem 
> 
> 
> 
> 
> 
> ServerName app.1com
> 
> WSGIScriptAlias / /var/www/app1/wsgi.py  application-group=%{GLOBAL}
> 
> 
> 
> #  app2.com 
> 
> 
> ServerName app2.com 
> ServerAlias app2.com  *.app2.com 
> ServerAdmin em...@example.com 
> 
> # WSGI Settings
> WSGIDaemonProcess app2 user=apache threads=7 
> python-home=/var/www/app2/venv
> WSGIScriptAlias / /var/www/app2/wsgi.py process-group= app2 
> application-group=%{GLOBAL}
> WSGIScriptReloading On
> 
> # Tell Apache where your app's code directory is
> DocumentRoot /var/www/app2 
>
># Logging 
>ErrorLog /var/www/app2/logs/app.log
>CustomLog /var/www/app2/logs/access.log combined
>LogLevel info ssl:warn
> 
> # Relax Apache security settings
> 
>   Allow from all
>   Options -MultiViews
>   # Uncomment this if you're on Apache >= 2.4:
>   Require all granted
> 
> 
> Alias /static /var/www/app2/application/static
> 
>   Allow from all
>   Options -MultiViews
>   Require all granted
> 
> 
> 
> RewriteEngine on
> RewriteCond %{SERVER_NAME} =app2.com  [OR]
> RewriteCond %{SERVER_NAME} =*. app2.com 
> RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} 
>  [END,NE,R=permanent]
> 
> 
> 
> Thanks in advance for your help.
> On Monday, January 8, 2018 at 12:06:29 AM UTC-8 shan...@gmail.com 
>  wrote:
> Hi
> 
> So, that's fixed it, explicitly setting the script alias per vhost, now the 
> problems are no longer bleeding into the (non-django serviced) additional 
> vhost.
> 
> Thanks
> Shane
> 
> 
> On Monday, January 8, 2018 at 6:35:55 PM UTC+11, Graham Dumpleton wrote:
> 
> 
>> On 8 Jan 2018, at 6:16 pm, Shane nunya > wrote:
>> 
>> Hi
>> 
>> I've got a similar problem, that I'm not sure is covered by your blog post.
>> 
>> I have got 3 possible domains, and one alias, everything was working fine, 
>> apache/mod_wsgi served the correct content for the appropriate URL. However, 
>> I decided to clever (which is what *always* leads to my downfall) and added 
>> HTTPS to one of my domains. In the process I had a problem where the ACME 
>> client provided by letsencrypt had issues caused by it copying the *80 
>> virtual hosts verbatim, therefore creating several mod_wsgi instances (one 
>> for each vhost) with the same name.
>> 
>> I found a SO post that suggested I switch to mod_wsgi as a global for the 
>> site, which fixed the issue, but now when I access one of the domains, the 
>> content from the default is loaded.
>> 
>> So the problem URL is git.mydomain.com , 
>> myotherdoma

Re: [modwsgi] RHEL: Apache, mod_wsgi daemon - Multiple Virtual Hosts defined but it always picks up the first one

2021-07-08 Thread Amber L
Hi, 

I also have a similar problem. I have two flask apps with separate domains 
but only the first is working properly. HTTPS only applies in the first 
domain app1.com. Below is the conf file. 

Any ideas on what I may be doing wrong? 


#  app1. com


ServerName app1.com
ServerAlias  app1.com *. app1.com
ServerAdmin em...@example.com

   # WSGI Settings
WSGIDaemonProcess  app1 user=apache threads=7 
python-home=/var/www/app1/venv
WSGIScriptAlias / /var/www/app1/wsgi.py process-group= 
app1 application-group=%{GLOBAL}
WSGIScriptReloading On

   # Tell Apache where your app's code directory is
DocumentRoot /var/www/app1
   
   # Logging 
   ErrorLog /var/www/app1/logs/app.log
   CustomLog /var/www/app1/logs/access.log combined
   LogLevel info ssl:warn

   # Relax Apache security settings
   
 
   Allow from all
   Options -MultiViews
   Require all granted
 
   

   Alias /static /var/www/app1/application/static
   
 Allow from all 
 Options -MultiViews
 Require all granted
   


RewriteEngine on
RewriteCond %{SERVER_NAME} = app1.com [OR]
RewriteCond %{SERVER_NAME} =*. app1.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/app1.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/app1.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/app1.com/chain.pem




ServerName app.1com

WSGIScriptAlias / /var/www/app1/wsgi.py  application-group=%{GLOBAL}



#  app2.com


ServerName app2.com
ServerAlias app2.com *.app2.com
ServerAdmin em...@example.com

# WSGI Settings
WSGIDaemonProcess app2 user=apache threads=7 
python-home=/var/www/app2/venv
WSGIScriptAlias / /var/www/app2/wsgi.py process-group= 
app2 application-group=%{GLOBAL}
WSGIScriptReloading On

# Tell Apache where your app's code directory is
DocumentRoot /var/www/app2 
   
   # Logging 
   ErrorLog /var/www/app2/logs/app.log
   CustomLog /var/www/app2/logs/access.log combined
   LogLevel info ssl:warn

# Relax Apache security settings

  Allow from all
  Options -MultiViews
  # Uncomment this if you're on Apache >= 2.4:
  Require all granted


Alias /static /var/www/app2/application/static

  Allow from all
  Options -MultiViews
  Require all granted



RewriteEngine on
RewriteCond %{SERVER_NAME} =app2.com [OR]
RewriteCond %{SERVER_NAME} =*. app2.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]



Thanks in advance for your help.
On Monday, January 8, 2018 at 12:06:29 AM UTC-8 shan...@gmail.com wrote:

> Hi
>
> So, that's fixed it, explicitly setting the script alias per vhost, now 
> the problems are no longer bleeding into the (non-django serviced) 
> additional vhost.
>
> Thanks
> Shane
>
>
> On Monday, January 8, 2018 at 6:35:55 PM UTC+11, Graham Dumpleton wrote:
>>
>>
>>
>> On 8 Jan 2018, at 6:16 pm, Shane nunya  wrote:
>>
>> Hi
>>
>> I've got a similar problem, that I'm not sure is covered by your blog 
>> post.
>>
>> I have got 3 possible domains, and one alias, everything was working 
>> fine, apache/mod_wsgi served the correct content for the appropriate URL. 
>> However, I decided to clever (which is what *always* leads to my downfall) 
>> and added HTTPS to one of my domains. In the process I had a problem where 
>> the ACME client provided by letsencrypt had issues caused by it copying the 
>> *80 virtual hosts verbatim, therefore creating several mod_wsgi instances 
>> (one for each vhost) with the same name.
>>
>> I found a SO post that suggested I switch to mod_wsgi as a global for the 
>> site, which fixed the issue, but now when I access one of the domains, the 
>> content from the default is loaded.
>>
>> So the problem URL is git.mydomain.com, myotherdomain.nz is *fine*; I 
>> suspect because of the WSGIProcessGroup directive.
>>
>> As I type this out I am wondering if the solution is to go back to an 
>> individual mod_wsgi process per vhost, but name each one differently, eg. 
>> https_mydomain and http_mydomain
>>
>>
>> You definitely want separate mod_wsgi daemon process group for each 
>> separate site.
>>
>> This is necessary as:
>>
>> WSGIApplicationGroup %{GLOBAL}
>>
>> would cause everything to run in the same Python interpreter context of 
>> the daemon processes.
>>
>> Some web frameworks can't handle mixing multiple sites in one 
>> interpreter, eg Django, plus you will have other problems with different 
>> sites need different versions of modules.
>>
>> So the pattern you want is:
>>
>> # Global stuff defined once.
>>
>> WSGIApplicationGroup %{GLOBAL}
>> WSGIRestrictEmbedded On
>>
>> # For first site.
>>
>> WSGIDaemonProcess mysite1 processes=2 threads=15 display-name=%{GROUP} 
>> python-home=/var/www/vhosts/mydomain/site1-venv
>>
>> 
>> ServerName site1.com
>>
>> WSGIScriptAlias / 

Re: [modwsgi] RHEL: Apache, mod_wsgi daemon - Multiple Virtual Hosts defined but it always picks up the first one

2018-01-08 Thread Shane nunya
Hi

So, that's fixed it, explicitly setting the script alias per vhost, now the 
problems are no longer bleeding into the (non-django serviced) additional 
vhost.

Thanks
Shane

On Monday, January 8, 2018 at 6:35:55 PM UTC+11, Graham Dumpleton wrote:
>
>
>
> On 8 Jan 2018, at 6:16 pm, Shane nunya > 
> wrote:
>
> Hi
>
> I've got a similar problem, that I'm not sure is covered by your blog post.
>
> I have got 3 possible domains, and one alias, everything was working fine, 
> apache/mod_wsgi served the correct content for the appropriate URL. 
> However, I decided to clever (which is what *always* leads to my downfall) 
> and added HTTPS to one of my domains. In the process I had a problem where 
> the ACME client provided by letsencrypt had issues caused by it copying the 
> *80 virtual hosts verbatim, therefore creating several mod_wsgi instances 
> (one for each vhost) with the same name.
>
> I found a SO post that suggested I switch to mod_wsgi as a global for the 
> site, which fixed the issue, but now when I access one of the domains, the 
> content from the default is loaded.
>
> So the problem URL is git.mydomain.com, myotherdomain.nz is *fine*; I 
> suspect because of the WSGIProcessGroup directive.
>
> As I type this out I am wondering if the solution is to go back to an 
> individual mod_wsgi process per vhost, but name each one differently, eg. 
> https_mydomain and http_mydomain
>
>
> You definitely want separate mod_wsgi daemon process group for each 
> separate site.
>
> This is necessary as:
>
> WSGIApplicationGroup %{GLOBAL}
>
> would cause everything to run in the same Python interpreter context of 
> the daemon processes.
>
> Some web frameworks can't handle mixing multiple sites in one interpreter, 
> eg Django, plus you will have other problems with different sites need 
> different versions of modules.
>
> So the pattern you want is:
>
> # Global stuff defined once.
>
> WSGIApplicationGroup %{GLOBAL}
> WSGIRestrictEmbedded On
>
> # For first site.
>
> WSGIDaemonProcess mysite1 processes=2 threads=15 display-name=%{GROUP} 
> python-home=/var/www/vhosts/mydomain/site1-venv
>
> 
> ServerName site1.com
>
> WSGIScriptAlias / /some/path/site1/wsgi.py process-group=mysite1 
> application-group=%{GLOBAL}
> 
>
> 
> ServerName site1.com
>
> WSGIScriptAlias / /some/path/site1/wsgi.py process-group=mysite1 
> application-group=%{GLOBAL}
> 
>
> # For second site.
>
> WSGIDaemonProcess mysite2 processes=2 threads=15 display-name=%{GROUP} 
> python-home=/var/www/vhosts/mydomain/site2-venv
>
> 
> ServerName site2.com 
>
> WSGIScriptAlias / /some/path/site2/wsgi.py process-group=mysite2 
> application-group=%{GLOBAL}
> 
>
> 
> ServerName site2.com 
>
> WSGIScriptAlias / /some/path/site2/wsgi.py process-group=mysite2 
> application-group=%{GLOBAL}
> 
>
>
>
> # Apache Conf file #
> LogFormat "%v - %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" 
> \"%{User-agent}i\"" combined-vhost
> WSGIApplicationGroup %{GLOBAL}
> WSGIRestrictEmbedded On
> WSGIScriptAlias / /var/www/vhosts/mydomain/mydomain/wsgi.py 
>  
> # adjust the following line to match your Python path 
> WSGIDaemonProcess mydomain.com processes=2 threads=15 
> display-name=%{GROUP} 
> python-home=/var/www/vhosts/mydomain/venv/lib/python2.7
>
>
> The value of python-home looks wrong.
>
> It should be the root of Python virtual environment, which is what 
> sys.prefix gives for interpreter. I would expect it to be 
> '/var/www/vhosts/mydomain/venv'.
>
> Not sure if that helps.
>
> Graham
>
> WSGIProcessGroup mydomain.com
>
>  
> ServerName www.mydomain.com 
> ServerAlias mydomain.com 
> DocumentRoot /var/www/vhosts/mydomain
> CustomLog /var/log/apache2/mydomain.log combined-vhost
>  
>  
>AllowOverride none 
>Require all granted 
>Options FollowSymlinks 
>  
>  
> Alias /static/ /var/www/vhosts/mydomain/mydomain/static/ 
>  
>  
>   AllowOverride none
>   Require all granted 
>  
>  
>  
> ServerName www.mydomain.com 
> ServerAlias mydomain.com 
> DocumentRoot /var/www/vhosts/mydomain
> CustomLog /var/log/apache2/mydomain_secure.log combined-vhost
>  
>  
>AllowOverride none 
>Require all granted 
>Options FollowSymlinks 
>  
>  
> Alias /static/ /var/www/vhosts/mydomain/mydomain/static/ 
>  
>  
>   AllowOverride none
>   Require all granted 
>  
> Include /etc/letsencrypt/options-ssl-apache.conf
> SSLCertificateFile /etc/letsencrypt/live/myotherdomain.nz/fullchain.pem
> SSLCertificateKeyFile /etc/letsencrypt/live/myotherdomain.nz/privkey.pem
> Include /etc/letsencrypt/options-ssl-apache.conf
>  
> 
> ServerName git.mydomain.com
> ServerAlias git.mydomain.com
> DocumentRoot /home/shane/code_repository/public
> CustomLog /var/log/apache2/git.log combined-vhost
> 
> Options Indexes 
> Require all granted
> AllowOverride none
> 
> 
> # END #
>
> On Monday, August 14, 2017 at 10:43:18 AM UTC+10, Graham Dumpleton wro

Re: [modwsgi] RHEL: Apache, mod_wsgi daemon - Multiple Virtual Hosts defined but it always picks up the first one

2018-01-07 Thread Graham Dumpleton


> On 8 Jan 2018, at 6:16 pm, Shane nunya  wrote:
> 
> Hi
> 
> I've got a similar problem, that I'm not sure is covered by your blog post.
> 
> I have got 3 possible domains, and one alias, everything was working fine, 
> apache/mod_wsgi served the correct content for the appropriate URL. However, 
> I decided to clever (which is what *always* leads to my downfall) and added 
> HTTPS to one of my domains. In the process I had a problem where the ACME 
> client provided by letsencrypt had issues caused by it copying the *80 
> virtual hosts verbatim, therefore creating several mod_wsgi instances (one 
> for each vhost) with the same name.
> 
> I found a SO post that suggested I switch to mod_wsgi as a global for the 
> site, which fixed the issue, but now when I access one of the domains, the 
> content from the default is loaded.
> 
> So the problem URL is git.mydomain.com , 
> myotherdomain.nz  is *fine*; I suspect because of 
> the WSGIProcessGroup directive.
> 
> As I type this out I am wondering if the solution is to go back to an 
> individual mod_wsgi process per vhost, but name each one differently, eg. 
> https_mydomain and http_mydomain

You definitely want separate mod_wsgi daemon process group for each separate 
site.

This is necessary as:

WSGIApplicationGroup %{GLOBAL}

would cause everything to run in the same Python interpreter context of the 
daemon processes.

Some web frameworks can't handle mixing multiple sites in one interpreter, eg 
Django, plus you will have other problems with different sites need different 
versions of modules.

So the pattern you want is:

# Global stuff defined once.

WSGIApplicationGroup %{GLOBAL}
WSGIRestrictEmbedded On

# For first site.

WSGIDaemonProcess mysite1 processes=2 threads=15 display-name=%{GROUP} 
python-home=/var/www/vhosts/mydomain/site1-venv


ServerName site1.com 

WSGIScriptAlias / /some/path/site1/wsgi.py process-group=mysite1 
application-group=%{GLOBAL}



ServerName site1.com 

WSGIScriptAlias / /some/path/site1/wsgi.py process-group=mysite1 
application-group=%{GLOBAL}


# For second site.

WSGIDaemonProcess mysite2 processes=2 threads=15 display-name=%{GROUP} 
python-home=/var/www/vhosts/mydomain/site2-venv


ServerName site2.com 

WSGIScriptAlias / /some/path/site2/wsgi.py process-group=mysite2 
application-group=%{GLOBAL}



ServerName site2.com 

WSGIScriptAlias / /some/path/site2/wsgi.py process-group=mysite2 
application-group=%{GLOBAL}



> 
> # Apache Conf file #
> LogFormat "%v - %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" 
> combined-vhost
> WSGIApplicationGroup %{GLOBAL}
> WSGIRestrictEmbedded On
> WSGIScriptAlias / /var/www/vhosts/mydomain/mydomain/wsgi.py 
>
> # adjust the following line to match your Python path 
> WSGIDaemonProcess mydomain.com  processes=2 threads=15 
> display-name=%{GROUP} python-home=/var/www/vhosts/mydomain/venv/lib/python2.7

The value of python-home looks wrong.

It should be the root of Python virtual environment, which is what sys.prefix 
gives for interpreter. I would expect it to be '/var/www/vhosts/mydomain/venv'.

Not sure if that helps.

Graham

> WSGIProcessGroup mydomain.com 
> 
>  
>   ServerName www.mydomain.com  
>   ServerAlias mydomain.com  
>   DocumentRoot /var/www/vhosts/mydomain
> CustomLog /var/log/apache2/mydomain.log combined-vhost
>
>
>  AllowOverride none 
>  Require all granted 
>  Options FollowSymlinks 
>
>
>   Alias /static/ /var/www/vhosts/mydomain/mydomain/static/ 
>
>
>   AllowOverride none
> Require all granted 
>
>  
>  
>   ServerName www.mydomain.com  
>   ServerAlias mydomain.com  
>   DocumentRoot /var/www/vhosts/mydomain
> CustomLog /var/log/apache2/mydomain_secure.log combined-vhost
>
>
>  AllowOverride none 
>  Require all granted 
>  Options FollowSymlinks 
>
>
>   Alias /static/ /var/www/vhosts/mydomain/mydomain/static/ 
>
>
>   AllowOverride none
> Require all granted 
>
> Include /etc/letsencrypt/options-ssl-apache.conf
> SSLCertificateFile /etc/letsencrypt/live/myotherdomain.nz/fullchain.pem 
> 
> SSLCertificateKeyFile /etc/letsencrypt/live/myotherdomain.nz/privkey.pem 
> 
> Include /etc/letsencrypt/options-ssl-apache.conf
>  
> 
> ServerName git.mydomain.com 
> ServerAlias git.mydomain.com 
> DocumentRoot /home/shane/code_repository/public
> CustomLog /var/log/apache2/git.log c

Re: [modwsgi] RHEL: Apache, mod_wsgi daemon - Multiple Virtual Hosts defined but it always picks up the first one

2018-01-07 Thread Shane nunya
Hi

I've got a similar problem, that I'm not sure is covered by your blog post.

I have got 3 possible domains, and one alias, everything was working fine, 
apache/mod_wsgi served the correct content for the appropriate URL. 
However, I decided to clever (which is what *always* leads to my downfall) 
and added HTTPS to one of my domains. In the process I had a problem where 
the ACME client provided by letsencrypt had issues caused by it copying the 
*80 virtual hosts verbatim, therefore creating several mod_wsgi instances 
(one for each vhost) with the same name.

I found a SO post that suggested I switch to mod_wsgi as a global for the 
site, which fixed the issue, but now when I access one of the domains, the 
content from the default is loaded.

So the problem URL is git.mydomain.com, myotherdomain.nz is *fine*; I 
suspect because of the WSGIProcessGroup directive.

As I type this out I am wondering if the solution is to go back to an 
individual mod_wsgi process per vhost, but name each one differently, eg. 
https_mydomain and http_mydomain

# Apache Conf file #
LogFormat "%v - %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" 
\"%{User-agent}i\"" combined-vhost
WSGIApplicationGroup %{GLOBAL}
WSGIRestrictEmbedded On
WSGIScriptAlias / /var/www/vhosts/mydomain/mydomain/wsgi.py 
 
# adjust the following line to match your Python path 
WSGIDaemonProcess mydomain.com processes=2 threads=15 display-name=%{GROUP} 
python-home=/var/www/vhosts/mydomain/venv/lib/python2.7
WSGIProcessGroup mydomain.com

 
ServerName www.mydomain.com 
ServerAlias mydomain.com 
DocumentRoot /var/www/vhosts/mydomain
CustomLog /var/log/apache2/mydomain.log combined-vhost
 
 
   AllowOverride none 
   Require all granted 
   Options FollowSymlinks 
 
 
Alias /static/ /var/www/vhosts/mydomain/mydomain/static/ 
 
 
  AllowOverride none
  Require all granted 
 
 
 
ServerName www.mydomain.com 
ServerAlias mydomain.com 
DocumentRoot /var/www/vhosts/mydomain
CustomLog /var/log/apache2/mydomain_secure.log combined-vhost
 
 
   AllowOverride none 
   Require all granted 
   Options FollowSymlinks 
 
 
Alias /static/ /var/www/vhosts/mydomain/mydomain/static/ 
 
 
  AllowOverride none
  Require all granted 
 
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/myotherdomain.nz/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/myotherdomain.nz/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
 

ServerName git.mydomain.com
ServerAlias git.mydomain.com
DocumentRoot /home/shane/code_repository/public
CustomLog /var/log/apache2/git.log combined-vhost

Options Indexes 
Require all granted
AllowOverride none


# END #

On Monday, August 14, 2017 at 10:43:18 AM UTC+10, Graham Dumpleton wrote:
>
> That would suggest you are using very old version of Apache 2.2. That 
> directive is not required in Apache 2.4.
>
> On 14 Aug 2017, at 1:30 am, rm...@cornell.edu  wrote:
>
> Actually I figured it out, my config was missing -
>
> NameVirtualHost *:80
>
> After adding that, the virtual hosts are getting called correctly.
>
> Thanks and Cheers!
>
> On Sunday, August 13, 2017 at 12:16:21 AM UTC-4, rm...@cornell.edu wrote:
>>
>> Also, I checked the blog link below but that is a little different. Both 
>> the URLs used in there end with the same domain address (e.g. example.com). 
>> My case is a little different as both the URLs have different domain 
>> addresses. Not sure if that matters?
>>
>> On Saturday, August 12, 2017 at 8:49:43 PM UTC-4, Graham Dumpleton wrote:
>>>
>>> For general advice see:
>>>
>>> http://blog.dscpl.com.au/2012/10/requests-running-in-wrong-django.html
>>>
>>> See further comments below.
>>>
>>> On 13 Aug 2017, at 9:45 am,   
>>> wrote:
>>>
>>> Hello,
>>>
>>> I am trying to setup two virtual hosts pertaining to two websites - lets 
>>> call them www.A.com  and www.B.com 
>>>  using apache, mod_wsgi daemon. Both the apps are 
>>> written using flask.
>>>
>>> Below is my apache conf file and for some reason it always picks the 
>>> first declared virtual host URL and executes the first flask application 
>>> for both URLs.
>>>
>>>
>>> What are the URLs you are using?
>>>
>>> Does the hostname in the URL match exactly what you are setting 
>>> ServerName to?
>>>
>>> I am still new to the mod_wsgi scene and was reading multiple virtual 
>>> hosts setup instructions from here - 
>>> http://modwsgi.readthedocs.io/en/develop/user-guides/configuration-guidelines.html
>>>
>>> Any idea how to get both of them working? The apache server is run as 
>>> root.
>>>
>>> Conf:
>>> WSGIPythonHome /usr/local/venvs/myenv
>>>
>>> 
>>>   ServerName www.A.com 
>>>
>>>   WSGIDaemonProcess www.A.com  threads=15 
>>> maximum-requests=1
>>>
>>>   WSGIScriptAlias / /var/www/A/A.wsgi
>>>   WSGIProcessGroup www.A.com 
>>>
>>>   
>>> Ord

Re: [modwsgi] RHEL: Apache, mod_wsgi daemon - Multiple Virtual Hosts defined but it always picks up the first one

2017-08-13 Thread Graham Dumpleton
That would suggest you are using very old version of Apache 2.2. That directive 
is not required in Apache 2.4.

> On 14 Aug 2017, at 1:30 am, rm...@cornell.edu wrote:
> 
> Actually I figured it out, my config was missing -
> 
> NameVirtualHost *:80
> 
> After adding that, the virtual hosts are getting called correctly.
> 
> Thanks and Cheers!
> 
> On Sunday, August 13, 2017 at 12:16:21 AM UTC-4, rm...@cornell.edu wrote:
> Also, I checked the blog link below but that is a little different. Both the 
> URLs used in there end with the same domain address (e.g. example.com 
> ). My case is a little different as both the URLs have 
> different domain addresses. Not sure if that matters?
> 
> On Saturday, August 12, 2017 at 8:49:43 PM UTC-4, Graham Dumpleton wrote:
> For general advice see:
> 
> http://blog.dscpl.com.au/2012/10/requests-running-in-wrong-django.html 
> 
> 
> See further comments below.
> 
>> On 13 Aug 2017, at 9:45 am, > > 
>> wrote:
>> 
>> Hello,
>> 
>> I am trying to setup two virtual hosts pertaining to two websites - lets 
>> call them www.A.com  and www.B.com  
>> using apache, mod_wsgi daemon. Both the apps are written using flask.
>> 
>> Below is my apache conf file and for some reason it always picks the first 
>> declared virtual host URL and executes the first flask application for both 
>> URLs.
> 
> What are the URLs you are using?
> 
> Does the hostname in the URL match exactly what you are setting ServerName to?
> 
>> I am still new to the mod_wsgi scene and was reading multiple virtual hosts 
>> setup instructions from here - 
>> http://modwsgi.readthedocs.io/en/develop/user-guides/configuration-guidelines.html
>>  
>> 
>> 
>> Any idea how to get both of them working? The apache server is run as root.
>> 
>> Conf:
>> WSGIPythonHome /usr/local/venvs/myenv
>> 
>> 
>>   ServerName www.A.com 
>> 
>>   WSGIDaemonProcess www.A.com  threads=15 
>> maximum-requests=1
>> 
>>   WSGIScriptAlias / /var/www/A/A.wsgi
>>   WSGIProcessGroup www.A.com 
>> 
>>   
>> Order allow,deny
>> Allow from all
>>   
>> 
>> 
>> 
>> 
>>   ServerName www.B.com 
>> 
>>   WSGIDaemonProcess www.B.com  threads=15 
>> maximum-requests=1
>> 
>>   WSGIScriptAlias / /var/www/B/B.wsgi
>>   WSGIProcessGroup www.Bl.com 
> 
> Do you mean www.B.com  here. Not www.BI.com 
> ?
> 
>> 
>>   
>> Order allow,deny
>> Allow from all
>>   
>> 
>> 
>> 
>> Thanks,
>> RM
>> 
>> 
>> 
>> -- 
>> 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 modwsgi+u...@googlegroups.com <>.
>> To post to this group, send email to mod...@googlegroups.com <>.
>> Visit this group at https://groups.google.com/group/modwsgi 
>> .
>> For more options, visit https://groups.google.com/d/optout 
>> .
> 
> 
> -- 
> 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 modwsgi+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to modwsgi@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/modwsgi 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
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 modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


Re: [modwsgi] RHEL: Apache, mod_wsgi daemon - Multiple Virtual Hosts defined but it always picks up the first one

2017-08-13 Thread rm374
Actually I figured it out, my config was missing -

NameVirtualHost *:80

After adding that, the virtual hosts are getting called correctly.

Thanks and Cheers!

On Sunday, August 13, 2017 at 12:16:21 AM UTC-4, rm...@cornell.edu wrote:
>
> Also, I checked the blog link below but that is a little different. Both 
> the URLs used in there end with the same domain address (e.g. example.com). 
> My case is a little different as both the URLs have different domain 
> addresses. Not sure if that matters?
>
> On Saturday, August 12, 2017 at 8:49:43 PM UTC-4, Graham Dumpleton wrote:
>>
>> For general advice see:
>>
>> http://blog.dscpl.com.au/2012/10/requests-running-in-wrong-django.html
>>
>> See further comments below.
>>
>> On 13 Aug 2017, at 9:45 am,   
>> wrote:
>>
>> Hello,
>>
>> I am trying to setup two virtual hosts pertaining to two websites - lets 
>> call them www.A.com and www.B.com using apache, mod_wsgi daemon. Both 
>> the apps are written using flask.
>>
>> Below is my apache conf file and for some reason it always picks the 
>> first declared virtual host URL and executes the first flask application 
>> for both URLs.
>>
>>
>> What are the URLs you are using?
>>
>> Does the hostname in the URL match exactly what you are setting 
>> ServerName to?
>>
>> I am still new to the mod_wsgi scene and was reading multiple virtual 
>> hosts setup instructions from here - 
>> http://modwsgi.readthedocs.io/en/develop/user-guides/configuration-guidelines.html
>>
>> Any idea how to get both of them working? The apache server is run as 
>> root.
>>
>> Conf:
>> WSGIPythonHome /usr/local/venvs/myenv
>>
>> 
>>   ServerName www.A.com
>>
>>   WSGIDaemonProcess www.A.com threads=15 maximum-requests=1
>>
>>   WSGIScriptAlias / /var/www/A/A.wsgi
>>   WSGIProcessGroup www.A.com
>>
>>   
>> Order allow,deny
>> Allow from all
>>   
>>
>> 
>>
>> 
>>   ServerName www.B.com
>>
>>   WSGIDaemonProcess www.B.com threads=15 maximum-requests=1
>>
>>   WSGIScriptAlias / /var/www/B/B.wsgi
>>   WSGIProcessGroup www.Bl.com
>>
>>
>> Do you mean www.B.com here. Not www.BI.com?
>>
>>
>>   
>> Order allow,deny
>> Allow from all
>>   
>>
>> 
>>
>> Thanks,
>> RM
>>
>>
>>
>> -- 
>> 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 modwsgi+u...@googlegroups.com.
>> To post to this group, send email to mod...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/modwsgi.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>

-- 
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 modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


Re: [modwsgi] RHEL: Apache, mod_wsgi daemon - Multiple Virtual Hosts defined but it always picks up the first one

2017-08-12 Thread rm374
Also, I checked the blog link below but that is a little different. Both 
the URLs used in there end with the same domain address (e.g. example.com). 
My case is a little different as both the URLs have different domain 
addresses. Not sure if that matters?

On Saturday, August 12, 2017 at 8:49:43 PM UTC-4, Graham Dumpleton wrote:
>
> For general advice see:
>
> http://blog.dscpl.com.au/2012/10/requests-running-in-wrong-django.html
>
> See further comments below.
>
> On 13 Aug 2017, at 9:45 am, > <
> rm...@cornell.edu > wrote:
>
> Hello,
>
> I am trying to setup two virtual hosts pertaining to two websites - lets 
> call them www.A.com and www.B.com using apache, mod_wsgi daemon. Both the 
> apps are written using flask.
>
> Below is my apache conf file and for some reason it always picks the first 
> declared virtual host URL and executes the first flask application for both 
> URLs.
>
>
> What are the URLs you are using?
>
> Does the hostname in the URL match exactly what you are setting ServerName 
> to?
>
> I am still new to the mod_wsgi scene and was reading multiple virtual 
> hosts setup instructions from here - 
> http://modwsgi.readthedocs.io/en/develop/user-guides/configuration-guidelines.html
>
> Any idea how to get both of them working? The apache server is run as root.
>
> Conf:
> WSGIPythonHome /usr/local/venvs/myenv
>
> 
>   ServerName www.A.com
>
>   WSGIDaemonProcess www.A.com threads=15 maximum-requests=1
>
>   WSGIScriptAlias / /var/www/A/A.wsgi
>   WSGIProcessGroup www.A.com
>
>   
> Order allow,deny
> Allow from all
>   
>
> 
>
> 
>   ServerName www.B.com
>
>   WSGIDaemonProcess www.B.com threads=15 maximum-requests=1
>
>   WSGIScriptAlias / /var/www/B/B.wsgi
>   WSGIProcessGroup www.Bl.com
>
>
> Do you mean www.B.com here. Not www.BI.com?
>
>
>   
> Order allow,deny
> Allow from all
>   
>
> 
>
> Thanks,
> RM
>
>
>
> -- 
> 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 modwsgi+u...@googlegroups.com .
> To post to this group, send email to mod...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/modwsgi.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
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 modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


Re: [modwsgi] RHEL: Apache, mod_wsgi daemon - Multiple Virtual Hosts defined but it always picks up the first one

2017-08-12 Thread rm374
The URLs that I am using are two separate web domain addresses that I have 
purchased recently and set their DNS to point to my VPS's IP.

Yes, that was a typo (it was meant to be B) but I have verified that my 
actual conf file has no typos.

Each URL is tied to a flask application but with that config, only the 
first one gets invoked for both of them. I will like the first one to go to 
first flask application and the second url to hit the second one.

Thanks in advance for your help on this.

On Saturday, August 12, 2017 at 8:49:43 PM UTC-4, Graham Dumpleton wrote:
>
> For general advice see:
>
> http://blog.dscpl.com.au/2012/10/requests-running-in-wrong-django.html
>
> See further comments below.
>
> On 13 Aug 2017, at 9:45 am, > <
> rm...@cornell.edu > wrote:
>
> Hello,
>
> I am trying to setup two virtual hosts pertaining to two websites - lets 
> call them www.A.com and www.B.com using apache, mod_wsgi daemon. Both the 
> apps are written using flask.
>
> Below is my apache conf file and for some reason it always picks the first 
> declared virtual host URL and executes the first flask application for both 
> URLs.
>
>
> What are the URLs you are using?
>
> Does the hostname in the URL match exactly what you are setting ServerName 
> to?
>
> I am still new to the mod_wsgi scene and was reading multiple virtual 
> hosts setup instructions from here - 
> http://modwsgi.readthedocs.io/en/develop/user-guides/configuration-guidelines.html
>
> Any idea how to get both of them working? The apache server is run as root.
>
> Conf:
> WSGIPythonHome /usr/local/venvs/myenv
>
> 
>   ServerName www.A.com
>
>   WSGIDaemonProcess www.A.com threads=15 maximum-requests=1
>
>   WSGIScriptAlias / /var/www/A/A.wsgi
>   WSGIProcessGroup www.A.com
>
>   
> Order allow,deny
> Allow from all
>   
>
> 
>
> 
>   ServerName www.B.com
>
>   WSGIDaemonProcess www.B.com threads=15 maximum-requests=1
>
>   WSGIScriptAlias / /var/www/B/B.wsgi
>   WSGIProcessGroup www.Bl.com
>
>
> Do you mean www.B.com here. Not www.BI.com?
>
>
>   
> Order allow,deny
> Allow from all
>   
>
> 
>
> Thanks,
> RM
>
>
>
> -- 
> 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 modwsgi+u...@googlegroups.com .
> To post to this group, send email to mod...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/modwsgi.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
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 modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


Re: [modwsgi] RHEL: Apache, mod_wsgi daemon - Multiple Virtual Hosts defined but it always picks up the first one

2017-08-12 Thread Graham Dumpleton
For general advice see:

http://blog.dscpl.com.au/2012/10/requests-running-in-wrong-django.html 


See further comments below.

> On 13 Aug 2017, at 9:45 am,   wrote:
> 
> Hello,
> 
> I am trying to setup two virtual hosts pertaining to two websites - lets call 
> them www.A.com and www.B.com using apache, mod_wsgi daemon. Both the apps are 
> written using flask.
> 
> Below is my apache conf file and for some reason it always picks the first 
> declared virtual host URL and executes the first flask application for both 
> URLs.

What are the URLs you are using?

Does the hostname in the URL match exactly what you are setting ServerName to?

> I am still new to the mod_wsgi scene and was reading multiple virtual hosts 
> setup instructions from here - 
> http://modwsgi.readthedocs.io/en/develop/user-guides/configuration-guidelines.html
> 
> Any idea how to get both of them working? The apache server is run as root.
> 
> Conf:
> WSGIPythonHome /usr/local/venvs/myenv
> 
> 
>   ServerName www.A.com
> 
>   WSGIDaemonProcess www.A.com threads=15 maximum-requests=1
> 
>   WSGIScriptAlias / /var/www/A/A.wsgi
>   WSGIProcessGroup www.A.com
> 
>   
> Order allow,deny
> Allow from all
>   
> 
> 
> 
> 
>   ServerName www.B.com
> 
>   WSGIDaemonProcess www.B.com threads=15 maximum-requests=1
> 
>   WSGIScriptAlias / /var/www/B/B.wsgi
>   WSGIProcessGroup www.Bl.com 

Do you mean www.B.com  here. Not www.BI.com 
?

> 
>   
> Order allow,deny
> Allow from all
>   
> 
> 
> 
> Thanks,
> RM
> 
> 
> 
> -- 
> 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 modwsgi+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to modwsgi@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/modwsgi 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
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 modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


[modwsgi] RHEL: Apache, mod_wsgi daemon - Multiple Virtual Hosts defined but it always picks up the first one

2017-08-12 Thread rm374
Hello,

I am trying to setup two virtual hosts pertaining to two websites - lets 
call them www.A.com and www.B.com using apache, mod_wsgi daemon. Both the 
apps are written using flask.

Below is my apache conf file and for some reason it always picks the first 
declared virtual host URL and executes the first flask application for both 
URLs.

I am still new to the mod_wsgi scene and was reading multiple virtual hosts 
setup instructions from here - 
http://modwsgi.readthedocs.io/en/develop/user-guides/configuration-guidelines.html

Any idea how to get both of them working? The apache server is run as root.

Conf:
WSGIPythonHome /usr/local/venvs/myenv


  ServerName www.A.com

  WSGIDaemonProcess www.A.com threads=15 maximum-requests=1

  WSGIScriptAlias / /var/www/A/A.wsgi
  WSGIProcessGroup www.A.com

  
Order allow,deny
Allow from all
  




  ServerName www.B.com

  WSGIDaemonProcess www.B.com threads=15 maximum-requests=1

  WSGIScriptAlias / /var/www/B/B.wsgi
  WSGIProcessGroup www.Bl.com

  
Order allow,deny
Allow from all
  



Thanks,
RM


-- 
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 modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.