Configure Apache httpd and nginx

These configurations will match the socket names or ports used in the uWSGI command lines and .ini files shown previously.

Complete (but simple) virtual server configurations are shown, with the application accessed from the root (/). For these first configurations, all requests are sent to the application, with none handled by the web server.

HTTP protocol, TCP port

httpd
Listen 80
<VirtualHost *:80>
  <Location />
    ProxyPass http://127.0.0.1:2000/
    ProxyPassReverse http://127.0.0.1:2000/
  </Location>
</VirtualHost>

It just wouldn't be right to talk about mod_proxy without repeating the standard warning: Don't set ProxyRequests to on unless you're trying to set up a forward proxy (which has nothing to do with Python web applications).

nginx
server {
    listen 80;
    location / {
        proxy_pass http://127.0.0.1:2000/;
    }
}

HTTP protocol, Unix socket

httpd
Listen 80
<VirtualHost *:80>
  <Location />
    ProxyPass unix:/tmp/helloHTTP.s|http://127.0.0.1/
    ProxyPassReverse unix:/tmp/helloHTTP.s|http://127.0.0.1/
  </Location>
</VirtualHost>
nginx
server {
    listen 80;
    location / {
        proxy_pass http://unix:/tmp/helloHTTP.s:/;
    }
}

FastCGI protocol, TCP socket

httpd
Listen 80
<VirtualHost *:80>
  <Location />
    ProxyPass fcgi://127.0.0.1:2001/
  </Location>
</VirtualHost>
nginx
server {
    listen 80;
    location / {
        include fastcgi_params;
        fastcgi_pass 127.0.0.1:2001;
    }
}

FastCGI protocol, Unix socket

httpd
Listen 80
<VirtualHost *:80>
  <Location />
    ProxyPass unix:/tmp/helloFastCGI.s|fcgi://127.0.0.1/
  </Location>
</VirtualHost>
nginx
server {
    listen 80;
    location / {
        include fastcgi_params;
        fastcgi_pass unix:/tmp/helloFastCGI.s;
    }
}

SCGI protocol, TCP socket

httpd
Listen 80
<VirtualHost *:80>
  <Location />
    ProxyPass scgi://127.0.0.1:2002/
  </Location>
</VirtualHost>
nginx
server {
    listen 80;
    location / {
        include scgi_params;
        scgi_pass 127.0.0.1:2002;
    }
}

SCGI protocol, Unix socket

httpd
Listen 80
<VirtualHost *:80>
  <Location />
    ProxyPass unix:/tmp/helloSCGI.s|scgi://127.0.0.1:2002/
  </Location>
</VirtualHost>
nginx
server {
    listen 80;
    location / {
        include scgi_params;
        scgi_pass unix:/tmp/helloSCGI.s;
    }
}

uwsgi protocol, TCP socket

httpd

The third-party module which implements this is not reliable for me with httpd 2.4.

nginx
server {
    listen 80;
    location / {
        include uwsgi_params;
        uwsgi_pass 127.0.0.1:2004;
    }
}

uwsgi protocol, Unix socket

httpd

The third-party module which implements this is not reliable for me with httpd 2.4, and it may need minor updates to work with Unix sockets anyway.

nginx
server {
    listen 80;
    location / {
        include uwsgi_params;
        uwsgi_pass unix:/tmp/helloUWSGI.s;
    }
}