samedi 26 juillet 2014

Déploiement de plusieurs projets de django sur apache avec mod_wsgi - Stack Overflow


I'm trying to deploy 2 django projects on Apache with mod_wsgi using daemon mode, but right now I just get 404's when I try to load the pages.


The two sites are hosted on the same server, both on port 80. The two entries in sites-avalable are below:


<VirtualHost *:80>
ServerAdmin admin@site1.com
ServerName site1.com
ServerAlias www.site1.com
DocumentRoot /var/www/site1.com
ErrorLog /srv/www/site1.com/logs/error.log
CustomLog /srv/www/site1.com/logs/access.log combined
</VirtualHost>

<VirtualHost *:80>
ServerAdmin webmaster@site2.org
ServerName site2.org
ServerAlias www.site2.org
DocumentRoot /var/www/site2.org
ErrorLog /srv/www/site2.org/logs/error.log
CustomLog /srv/www/site2.org/logs/access.log combined
</VirtualHost>

And in my httpd.conf,


WSGIDaemonProcess site1.com python-path=/usr/local/www/site1/
WSGIProcessGroup site1.com
WSGIScriptAlias site1.com/blog /usr/local/www/site1/site1/wsgi.py

WSGIDaemonProcess site2.org python-path=/usr/local/www/site2/
WSGIProcessGroup site2.org
WSGIScriptAlias site2.org/ /usr/local/www/site2/site2/wsgi.py

<Directory /usr/local/www/site1/site1>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>

<Directory /usr/local/www/site2/site2>
<Files wsgi.py>
Order deny, allow
Allow from all
</Files>
</Directory>

I took the httpd.conf stuff right out of the Django docs, but it's still not working properly. site1.com/blog gives me a 404, and site2.org gives me a generic Apache filetree. What am I missing here?




If you have a sites-available directory, you're on a Debian-derived distro, and you shouldn't be editing httpd.conf at all. All the stuff that you've put into httpd.conf should go in the relevant files in sites-available.



I'm trying to deploy 2 django projects on Apache with mod_wsgi using daemon mode, but right now I just get 404's when I try to load the pages.


The two sites are hosted on the same server, both on port 80. The two entries in sites-avalable are below:


<VirtualHost *:80>
ServerAdmin admin@site1.com
ServerName site1.com
ServerAlias www.site1.com
DocumentRoot /var/www/site1.com
ErrorLog /srv/www/site1.com/logs/error.log
CustomLog /srv/www/site1.com/logs/access.log combined
</VirtualHost>

<VirtualHost *:80>
ServerAdmin webmaster@site2.org
ServerName site2.org
ServerAlias www.site2.org
DocumentRoot /var/www/site2.org
ErrorLog /srv/www/site2.org/logs/error.log
CustomLog /srv/www/site2.org/logs/access.log combined
</VirtualHost>

And in my httpd.conf,


WSGIDaemonProcess site1.com python-path=/usr/local/www/site1/
WSGIProcessGroup site1.com
WSGIScriptAlias site1.com/blog /usr/local/www/site1/site1/wsgi.py

WSGIDaemonProcess site2.org python-path=/usr/local/www/site2/
WSGIProcessGroup site2.org
WSGIScriptAlias site2.org/ /usr/local/www/site2/site2/wsgi.py

<Directory /usr/local/www/site1/site1>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>

<Directory /usr/local/www/site2/site2>
<Files wsgi.py>
Order deny, allow
Allow from all
</Files>
</Directory>

I took the httpd.conf stuff right out of the Django docs, but it's still not working properly. site1.com/blog gives me a 404, and site2.org gives me a generic Apache filetree. What am I missing here?



If you have a sites-available directory, you're on a Debian-derived distro, and you shouldn't be editing httpd.conf at all. All the stuff that you've put into httpd.conf should go in the relevant files in sites-available.


0 commentaires:

Enregistrer un commentaire