layerindex-web/docker/nginx-ssl.conf
Paul Eggleton 272f0eded2 docker: enhance example setup
* Put NGINX, Celery, and RabbitMQ into their own separate containers
* Use a docker network instead of the deprecated --link
* Allow for collecting the static files properly
* Create a copy of settings.py specifically for the docker setup. This
  will need to be kept in sync with the main example settings.py, but
  it avoids the user having to edit it too much.
* Add optional SSL configuration using letsencrypt certificate
* Create some volumes for static files / fetched repos
* Add some more helpful setup instructions

Largely based upon work by Michael Halstead <michael@yoctoproject.org>.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-07-23 08:40:00 +02:00

117 lines
2.8 KiB
Plaintext

#daemon off; ##Included in CMD
error_log /dev/stdout info;
worker_processes 1;
# user nobody nogroup;
pid /tmp/nginx.pid;
events {
worker_connections 1024;
accept_mutex off;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /dev/stdout combined;
sendfile on;
upstream app_server {
# For a TCP configuration:
server layersapp:5000 fail_timeout=0;
}
server {
listen 80 default;
client_max_body_size 4G;
server_name _;
keepalive_timeout 5;
# path for static files
root /usr/share/nginx/html;
return 301 https://layers.openembedded.org$request_uri;
}
server {
listen 80;
client_max_body_size 4G;
server_name layers.openembedded.org;
keepalive_timeout 5;
# path for static files
root /usr/share/nginx/html;
location /favicon.ico {
return 301 http://layers.openembedded.org/static/img/favicon.ico;
}
location /admin {
return 301 https://layers.openembedded.org$request_uri;
}
location /accounts/login {
return 301 https://layers.openembedded.org$request_uri;
}
location / {
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}
}
server {
listen 443 ssl default;
server_name _;
ssl_certificate /etc/letsencrypt/live/layers.openembedded.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/layers.openembedded.org/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
keepalive_timeout 5;
# path for static files
root /usr/share/nginx/html;
return 301 https://layers.openembedded.org$request_uri;
}
server {
listen 443 ssl;
server_name layers.openembedded.org;
ssl_certificate /etc/letsencrypt/live/layers.openembedded.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/layers.openembedded.org/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
# path for static files
root /usr/share/nginx/html;
location /favicon.ico {
return 301 https://layers.openembedded.org/static/img/favicon.ico;
}
location / {
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}
}
}