Unless you set ServerName in each VirtualHost with a different host name, and
access them as different host name in URL, you will need to have both sites at
the separate sub URLs defined in the same VirtualHost, not separate ones.
WSGIRestrictEmbedded On
<VirtualHost *:80>
WSGIDaemonProcess site1 python-path=/home/user/site1
python-home=/home/user/site1/venv1
WSGIScriptAlias /site1 /home/user/site1/site1/wsgi.py
process-group=site1 application-group=%{GLOBAL}
Alias /static /home/user/site1/static
<Directory /home/user/site1/static>
Require all granted
</Directory>
<Directory /home/user/site1/site1>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess site2 python-path=/home/user/site2
python-home=/home/user/site2/venv2
WSGIScriptAlias /site2 /home/user/site2/site2/wsgi.py
process-group=site2 application-group=%{GLOBAL}
Alias /static /home/user/site2/static
<Directory /home/user/site2/static>
Require all granted
</Directory>
<Directory /home/user/site2/site2>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
> On 20 Feb 2019, at 5:27 am, [email protected] wrote:
>
> Hi,
>
> I have deployed two Django sites on apache server with mod_wsgi. When I
> enable site1.conf and site2.conf separately, my sites work correctly. But
> when I enable both site1.conf and site2.conf, then site1 shows error "404 Not
> Found: The requested URL /site1 was not found on this server." and site2
> still works correctly!
>
> I guess the problem is in .conf files. Here is my
> /etc/apache2/sites-available/site1.conf
> ==============================================================================
> <VirtualHost *:80>
>
> Alias /static /home/user/site1/static
> <Directory /home/user/site1/static>
> Require all granted
> </Directory>
>
> <Directory /home/user/site1/site1>
> <Files wsgi.py>
> Require all granted
> </Files>
> </Directory>
>
>
> WSGIScriptAlias /site1 /home/user/site1/site1/wsgi.py
> WSGIDaemonProcess site1 python-path=/home/user/site1
> python-home=/home/user/site1/venv1
> WSGIProcessGroup site1
>
> </VirtualHost>
> ======================================================================================
>
> And here is my etc/apache2/sites-available/site2.conf
> ======================================================================================
> <VirtualHost *:80>
>
> Alias /static /home/user/site2/static
> <Directory /home/user/site2/static>
> Require all granted
> </Directory>
>
> <Directory /home/user/site2/site2>
> <Files wsgi.py>
> Require all granted
> </Files>
> </Directory>
>
>
> WSGIScriptAlias /site2 /home/user/site2/site2/wsgi.py
> WSGIDaemonProcess site2 python-path=/home/user/site2
> python-home=/home/user/site2/venv2
> WSGIProcessGroup site2
>
> </VirtualHost>
> ================================================================================================
>
> So, what is wrong?
>
> I'm a beginning programmer and that's my first deployment experience.
>
>
>
> --
> 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]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/modwsgi
> <https://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout
> <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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.