Skip to content

Commit 84368d3

Browse files
Initial commit
0 parents  commit 84368d3

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM ubuntu:trusty
2+
MAINTAINER Wouter ten Bosch <[email protected]>
3+
4+
# Install Nginx
5+
RUN apt-get update && \
6+
DEBIAN_FRONTEND=noninteractive apt-get -yq install nginx && \
7+
rm -rf /var/lib/apt/lists/*
8+
9+
# Delete default configuration
10+
RUN rm -v /etc/nginx/nginx.conf
11+
ADD nginx.conf /etc/nginx/
12+
13+
# Replace configuration
14+
ADD run.sh /run.sh
15+
RUN chmod 755 /*.sh
16+
17+
# Set reverse proxy domain
18+
ENV REVERSE_DOMAIN example.com
19+
20+
# Start Nginx
21+
#CMD sed -i "s/_REPLACE_ME_/$REVERSE_DOMAIN/g" /etc/nginx/nginx.conf && tail -F /var/log/nginx/* & /usr/sbin/nginx
22+
#CMD ["/etc/nginx/run.sh"]
23+
24+
# Expose and start
25+
EXPOSE 80
26+
CMD ["/run.sh"]

nginx.conf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
daemon off;
2+
3+
worker_processes 1;
4+
5+
events { worker_connections 1024; }
6+
7+
http {
8+
9+
sendfile on;
10+
11+
server {
12+
13+
listen 80;
14+
15+
location / {
16+
proxy_pass http://_REPLACE_ME_/;
17+
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
18+
proxy_redirect off;
19+
proxy_buffering off;
20+
proxy_set_header Host _REPLACE_ME_;
21+
proxy_set_header X-Real-IP $remote_addr;
22+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
23+
}
24+
}
25+
}

run.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
echo "Configuring Nginx Reverse Proxy..."
4+
5+
sed -i "s/_REPLACE_ME_/$REVERSE_DOMAIN/g" /etc/nginx/nginx.conf
6+
7+
echo "Starting Nginx Reverse Proxy..."
8+
9+
tail -F /var/log/nginx/* &
10+
exec /usr/sbin/nginx

0 commit comments

Comments
 (0)