1
0
mirror of https://github.com/nginx-proxy/nginx-proxy synced 2025-05-02 06:05:26 +02:00

Merge b1322d8771fefe3fbc78d9466277b7430e69453c into d831c058f3fea749f49909a638c0ceff7669ea13

This commit is contained in:
mko-x 2015-02-23 19:24:00 +00:00
commit 3fd2f75167
3 changed files with 26 additions and 3 deletions

@ -1,7 +1,7 @@
FROM nginx:1.7.8
MAINTAINER Jason Wilder jwilder@litl.com
MAINTAINER https://m-ko-x.de Markus Kosmal <code@m-ko-x.de>
# Install wget and install/updates certificates
# install packages
RUN apt-get update \
&& apt-get install -y -q --no-install-recommends \
ca-certificates \
@ -12,7 +12,7 @@ RUN apt-get update \
# Configure Nginx and apply fix for very long server names
RUN echo "daemon off;" >> /etc/nginx/nginx.conf \
&& sed -i 's/^http {/&\n server_names_hash_bucket_size 128;/g' /etc/nginx/nginx.conf
# Install Forego
RUN wget -P /usr/local/bin https://godist.herokuapp.com/projects/ddollar/forego/releases/current/linux-amd64/forego \
&& chmod u+x /usr/local/bin/forego

@ -1,5 +1,13 @@
![nginx 1.7.8](https://img.shields.io/badge/nginx-1.7.8-brightgreen.svg) ![License MIT](https://img.shields.io/badge/license-MIT-blue.svg)
##Modifications
To make Jason's nginx-proxy work for me, I changed:
- added rewrite of 'www'-prefixed domains to 301 without prefix for both https and http protocol
##Original
nginx-proxy sets up a container running nginx and [docker-gen][1]. docker-gen generates reverse proxy configs for nginx and reloads nginx when containers are started and stopped.
See [Automated Nginx Reverse Proxy for Docker][2] for why you might want to use this.

@ -87,11 +87,19 @@ upstream {{ $host }} {
{{ if (and (ne $cert "") (exists (printf "/etc/nginx/certs/%s.crt" $cert)) (exists (printf "/etc/nginx/certs/%s.key" $cert))) }}
server {
client_max_body_size 1000m;
server_name www.{{ $host }};
rewrite ^(.*) https://{{ $host }}$1 permanent;
}
server {
client_max_body_size 1000m;
server_name {{ $host }};
rewrite ^(.*) https://{{ $host }}$1 permanent;
}
server {
client_max_body_size 1000m;
server_name {{ $host }};
listen 443 ssl;
@ -122,6 +130,13 @@ server {
{{ else }}
server {
client_max_body_size 1000m;
server_name www.{{ $host }};
rewrite ^(.*) http://{{ $host }}$1 permanent;
}
server {
client_max_body_size 1000m;
server_name {{ $host }};
{{ if (exists (printf "/etc/nginx/vhost.d/%s" $host)) }}