How to install Django+nginx+apache+mod_wsgi
I have installed Apache2, mod_wsgi, Django.
I have not managed to run the server with Django I serve static content with nginx, changing the port 80, the page does not load.
"/etc/apache2/sites-availables/dominio.com
<virtualhost *:8080="">ServerName dominio.com
ServerAlias www.dominio.com
ServerAdmin admin@dominio.com
DocumentRoot /var/www
WSGIScriptAlias / /home/user/mysite/mysite/wsgi.py
WSGIPythonPath /home/user/mysite
<directory home="" user="" mysite=""><files wsgi.py="">Order allow,deny
Allow from all</files></directory>
ErrorLog /var/logs/error.log
CustomLog /var/logs/access.log combined</virtualhost>
'/etc/apache2/ports.conf'
NameVirtualHost *:8080
Listen 8080
<ifmodule mod_ssl.c=""># If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to <virtualhost *:443=""># Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
Listen 443</virtualhost></ifmodule>
<ifmodule mod_gnutls.c="">Listen 443</ifmodule>
Please share any guide to install "Django1.4"+apach2+nginx+mod_wsgi.
Thank you very much.
4 Replies
# for use of the multiprocessing module
WSGIRestrictStdin Off
# Django main site, threaded for non-session and non-weave pages
WSGIDaemonProcess zunzun user=www-data group=www-data processes=2 threads=10 maximum-requests=100
WSGIImportScript /home/zunzun/current/wsgi.handler process-group=zunzun application-group=%{GLOBAL}
WSGIDaemonProcess zunzun_recycle user=www-data group=www-data processes=6 threads=1 maximum-requests=1
WSGIImportScript /home/zunzun/current/wsgi.handler process-group=zunzun_recycle application-group=%{GLOBAL}
# Django testing and development
WSGIDaemonProcess zunzun_test user=www-dev group=www-data processes=1 threads=2 maximum-requests=50
WSGIImportScript /home/zunzun/development/wsgi.handler process-group=zunzun_test application-group=%{GLOBAL}
WSGIDaemonProcess zunzun_recycle_test user=www-dev group=www-data processes=1 threads=1 maximum-requests=1
WSGIImportScript /home/zunzun/development/wsgi.handler process-group=zunzun_recycle_test application-group=%{GLOBAL}
WSGIApplicationGroup %{GLOBAL}
@Cromulent:
Why don't you ditch Apache completely? I use Nginx for everything (two Wordpress sites and a Django site). It seems silly to have two capable HTTP servers on the same machine. Ditch Apache and just stick with Nginx for everything.
It's not silly. There are good reasons to use both Nginx and Apache on the same server.
1. Nginx can handle way more concurrent connections than Apache so it makes an awesome proxy in front of an apache server or even multiple apache servers.
2. Nginx excels at serving static content while Apache excels at serving dynamic content like php or python. If they both serve what they're best at instead of having one serve static and dynamic content, you'll end up serving your web pages faster.
3. Apache has way more modules, especially authentication modules than Nginx. So for example, if need you some fancy authentication method, there's most likely an existing Apache module for it.
Don't get me wrong though, I LOVE Nginx and it's my go to web server but don't be so quick at ditching Apache.
@limitedquantities:
2. Nginx excels at serving static content while Apache excels at serving dynamic content like php or python. If they both serve what they're best at instead of having one serve static and dynamic content, you'll end up serving your web pages faster.
[Citation Needed]
Do you have any benchmarks that show that Apache handles dynamic content faster than nginx?