Ok! Understood, I will put both in the same VirtualHost file and add 
process-group option on WSGIScriptAlias, I will let you know the result, 
thank you!!

El miércoles, 17 de febrero de 2021 a las 21:03:40 UTC+1, Graham Dumpleton 
escribió:

>
> On 18 Feb 2021, at 7:00 am, Dostowiesky Ugel <[email protected]> wrote:
>
> Good evening! thanks for the quick answer!
>
> I put the ServerName in the apache2.conf file in /etc/apache2/apache2.conf
>  
>
> Below the code:
>
> # Global configuration
> #
> ServerName https://apps.dostow.tech
>
> If I have to put the ServerName in each VirtualHost can it be the same one 
> in both files?
>
>
> No it can't. Apache would always use the first VirtualHost found if you 
> did.
>
> You will have to merge the two VirtualHost definitions. Just ensure the 
> WSGIScriptAlias for the sub path appears before that for the root of the 
> site so it takes precedence. Ensure you use process-group option on 
> WSGIScriptAlias instead of WSGIProcessGroup directive. Doing it this way is 
> mentioned in the post I linked.
>
> I have only one subdomain "apps.dostow.tech" in this case so I can not 
> use another.
>
> Thanks again for your help!!
>
>
> El miércoles, 17 de febrero de 2021 a las 20:27:46 UTC+1, Graham Dumpleton 
> escribió:
>
>> You aren't specifying ServerName directive in each VirtualHost for a 
>> start so Apache can't tell the VirtualHost's apart by host name.
>>
>> Was that only in the email that you left them out?
>>
>> See:
>>
>> * http://blog.dscpl.com.au/2012/10/requests-running-in-wrong-django.html
>>
>> for general advice on multiple sites being mixed up when using Django.
>>
>> Just note the post is old and using process-group and application-group 
>> options to WSGIScriptAlias is now the preferred.
>>
>> Graham
>>
>> On 18 Feb 2021, at 1:34 am, Dostowiesky Ugel <[email protected]> wrote:
>>
>> Good morning, I'm trying to enable two Django Websites in my server but I 
>> can not make it work, I have only one subdomain and both sites should work 
>> from it.
>>
>> The problem is that when I activate site's 1 virtualhost I can see it 
>> perfectly, but when I activate the site's 2 virtualhost I can only see site 
>> 2, and then when I try to see site 1 it shows the apache2 default page.
>>
>> Below is my config
>>
>> My site 1 is the root.
>>
>>        * Site 1 VirtualHost*
>> <IfModule mod_ssl.c>
>>     <VirtualHost *:443>
>>         ServerAdmin webmaster@localhost
>>         #DocumentRoot /var/www/html
>>
>>
>>         ErrorLog ${APACHE_LOG_DIR}/error.log
>>         CustomLog ${APACHE_LOG_DIR}/access.log combined
>>
>>         #   SSL Engine Switch:
>>         #   Enable/Disable SSL for this virtual host.
>>         SSLEngine on
>>
>>         #   A self-signed (snakeoil) certificate can be created by 
>> installing
>>         #   the ssl-cert package. See
>>         #   /usr/share/doc/apache2/README.Debian.gz for more info.
>>         #   If both key and certificate are stored in the same file, only 
>> the
>>         #   SSLCertificateFile directive is needed.
>>         SSLCertificateFile /etc/letsencrypt/route to my certificate
>>                 SSLCertificateKeyFile /etc/letsencrypt/route to my 
>> certificate
>>
>>        
>>         #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
>>         <FilesMatch "\.(cgi|shtml|phtml|php)$">
>>                 SSLOptions +StdEnvVars
>>         </FilesMatch>
>>         <Directory /usr/lib/cgi-bin>
>>                 SSLOptions +StdEnvVars
>>         </Directory>
>>
>>         #Prestashop
>>         alias /prestashop /var/www/html/prestashop
>>         <Directory /var/www/html/prestashop>
>>             Require all granted
>>         </Directory>
>>        
>>
>>         #My website
>>
>>                 alias /static /route to my static folder/static
>>                 <Directory /route to my static folder/static>
>>                   Require all granted
>>                 </Directory>
>>
>>                 <Directory /route to my wsgi.py folder>
>>                 <Files wsgi.py>
>>                         Require all granted
>>                 </Files>
>>                 </Directory>
>>
>>                 WSGIDaemonProcess site python-path=/pathtomanage.pyfolder 
>> python-home=/pathtothevenvfolder
>>                 WSGIProcessGroup site
>>                 WSGIScriptAlias / 
>> /home/dostow/dostowsite/webcode/webcode/wsgi.py application-group=%{GLOBAL}
>>     </VirtualHost>
>> </IfModule>
>> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
>>
>>               *  Site 2 VirtualHost*
>> <IfModule mod_ssl.c>
>>     <VirtualHost *:443>
>>         ServerAdmin webmaster@localhost
>>
>>         ErrorLog ${APACHE_LOG_DIR}/error.log
>>         CustomLog ${APACHE_LOG_DIR}/access.log combined
>>
>>         #   SSL Engine Switch:
>>         #   Enable/Disable SSL for this virtual host.
>>         SSLEngine on
>>
>>         #   A self-signed (snakeoil) certificate can be created by 
>> installing
>>         #   the ssl-cert package. See
>>         #   /usr/share/doc/apache2/README.Debian.gz for more info.
>>         #   If both key and certificate are stored in the same file, only 
>> the
>>         #   SSLCertificateFile directive is needed.
>>         SSLCertificateFile /etc/letsencrypt/live/route to my certificate
>>                 SSLCertificateKeyFile /etc/letsencrypt/live/route to my 
>> certificate
>>
>>         #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
>>         <FilesMatch "\.(cgi|shtml|phtml|php)$">
>>                 SSLOptions +StdEnvVars
>>         </FilesMatch>
>>         <Directory /usr/lib/cgi-bin>
>>                 SSLOptions +StdEnvVars
>>         </Directory>
>>
>>                
>>         #AAVVMARESME
>>         alias /site2/static /route to my static folder/static
>>                 <Directory /route to my static folder/static>
>>                   Require all granted
>>                 </Directory>
>>
>>                 <Directory /route to my wsgi.py folder>
>>                 <Files wsgi.py>
>>                         Require all granted
>>                 </Files>
>>                 </Directory>
>>
>>                 WSGIDaemonProcess site2 
>> python-path=/pathtomanage.pyfolder python-home=/pathtothevenvfolder
>>                 WSGIProcessGroup site2
>>                 WSGIScriptAlias /site2 /route to my wsgi.py 
>> folder/wsgi.py application-group=%{GLOBAL}
>>     </VirtualHost>
>> </IfModule>
>>
>> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
>>
>> i would appreciate your help!!
>>
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/modwsgi/724c9d9d-249e-4e12-a426-2c24d525289cn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/modwsgi/724c9d9d-249e-4e12-a426-2c24d525289cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>>
>>
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/modwsgi/c9d44eea-14ee-4484-9d05-1590978994a0n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/modwsgi/c9d44eea-14ee-4484-9d05-1590978994a0n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/74be5dad-c5e0-4fa4-8dfc-88eea2722c05n%40googlegroups.com.

Reply via email to