Skip to content

Commit

Permalink
Introduce some nginx examples
Browse files Browse the repository at this point in the history
To make it easier to use a reverse proxy with PyCA, this patch add some example
configuration files for nginx.
  • Loading branch information
shaardie authored and lkiesow committed May 21, 2020
1 parent 0e3e1e1 commit 1fb57db
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ using Gunicorn, would be to run::
For more information, have a look at the help option of gunicorn or go to the
`Gunicorn online documentation`_.

In addition to the WSGI server, you should use a reverse proxy,
if you want the ui to listen to anything but `localhost`.
Some example configuration files for Nginx_ can be found under `reverse-proxy <reverse-proxy>`_.

JSON API
********
Expand Down Expand Up @@ -175,6 +178,7 @@ file while simultaneously updating a still image every second.
.. _Opencast: https://opencast.org
.. _GNU Lesser General Public License: https://raw.githubusercontent.com/opencast/pyCA/master/license.lgpl
.. _Raspberry Pi: https://raspberrypi.org
.. _Nginx: https://www.nginx.com
.. _AUR: https://aur.archlinux.org/packages/pyca
.. _Gunicorn online documentation: https://gunicorn.org
.. _Travis configuration: https://raw.githubusercontent.com/opencast/pyCA/master/.travis.yml
Expand Down
26 changes: 26 additions & 0 deletions reverse-proxy/nginx-tls.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# <server_name must be replaced with the actuall server name>
#
# If installed, the snakeoil certificate is an automatically generated self
# signed certificate. For a proper installation a proper certificate like one
# from https://letsencrypt.org/ is needed.

server {
listen 80;
listen [::]:80;
server_name _;
location / {
return 302 https://<server_name>$request_uri;
}
}

server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name <server_name>;
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;

location / {
proxy_pass http://127.0.0.1:8000;
}
}
7 changes: 7 additions & 0 deletions reverse-proxy/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
server {
listen 80;
listen [::]:80;
location / {
proxy_pass http://127.0.0.1:8000;
}
}

0 comments on commit 1fb57db

Please sign in to comment.