only use ssl if certificate is specified

Signed-off-by: Markus Opahle <3225748+mopahle@users.noreply.github.com>
This commit is contained in:
Markus Opahle 2019-02-28 14:06:59 +01:00
parent 3a7bf6a8ac
commit ed568f569c
5 changed files with 7 additions and 7 deletions

View File

@ -439,7 +439,7 @@ Before starting the build process, review the [inventory](./installer/inventory)
*host_port*
> Provide a port number that can be mapped from the Docker daemon host to the web server running inside the AWX container. Defaults to *443*.
> Provide a port number that can be mapped from the Docker daemon host to the web server running inside the AWX container. Defaults to *80*.
*ssl_certificate*

View File

@ -52,7 +52,7 @@ dockerhub_base=ansible
awx_task_hostname=awx
awx_web_hostname=awxweb
postgres_data_dir=/tmp/pgdocker
host_port=443
host_port=80
#ssl_certificate=
# Docker Compose Install

View File

@ -129,7 +129,7 @@
- name: Stage nginx.conf
template:
src: nginx.conf
src: nginx.conf.j2
dest: "{{ docker_base_path }}/nginx.conf"
delegate_to: localhost

View File

@ -53,10 +53,6 @@ RUN rm -rf /tmp/*
RUN echo "{{ awx_version }}" > /var/lib/awx/.tower_version
ADD nginx.conf /etc/nginx/nginx.conf
RUN openssl req -newkey rsa:4906 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem -subj "/CN=localhost/" && \
cat certificate.pem key.pem > /etc/nginx/awxweb.pem && \
chmod 0600 /etc/nginx/awxweb.pem && \
rm certificate.pem key.pem
ADD supervisor.conf /supervisor.conf
ADD supervisor_task.conf /supervisor_task.conf
ADD launch_awx.sh /usr/bin/launch_awx.sh

View File

@ -36,10 +36,14 @@ http {
}
server {
{% if ssl_certificate is defined %}
listen 8052 ssl default_server;
ssl_certificate /etc/nginx/awxweb.pem;
ssl_certificate_key /etc/nginx/awxweb.pem;
{% else %}
listen 8052 default_server;
{% endif %}
# If you have a domain name, this is where to add it
server_name _;