Skip to content

Commit

Permalink
added nginx server
Browse files Browse the repository at this point in the history
  • Loading branch information
ropnop committed Jul 14, 2019
1 parent 3be5b6b commit e2ffb72
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nginxserve/Dockerfile
@@ -0,0 +1,7 @@
FROM nginx:stable
RUN apt-get update && apt-get install -y openssl
RUN mkdir -p /etc/nginx/ssl && mkdir -p /srv/data

COPY default.conf /etc/nginx/conf.d/
COPY start.sh /
ENTRYPOINT [ "/start.sh" ]
15 changes: 15 additions & 0 deletions nginxserve/default.conf
@@ -0,0 +1,15 @@
server {
listen 80;
listen 443 default_server ssl;

server_name localhost;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;


location / {
alias /srv/data/;
autoindex on;

}
}
7 changes: 7 additions & 0 deletions nginxserve/start.sh
@@ -0,0 +1,7 @@
#!/bin/bash

if [[ ! -f /etc/nginx/ssl/server.crt || ! -f /etc/nginx/ssl/server.crt ]]; then
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/server.key -out /etc/nginx/ssl/server.crt -subj '/CN=www.example.com'
fi

nginx -g 'daemon off;'

0 comments on commit e2ffb72

Please sign in to comment.