Hello all! First, please excuse my English as it is not my main language. I will try to explain as best as I can the issue that I am having.
In an Ubuntu server, I have a Python application that I made. I also made a container to hold said application. The docker-compose file creates a container for the MySQL database I’m using, and another container for the app, which is created via the Dockerfile. Everything works perfectly, after I’ve done my Apache2 conf file with the ProxyReverse setting. The only problem is that I can’t use SSL (https) in my site. I configured everything including the certificates (which are wildcards, there are other apps in the server), but the only way it will work is if I enter into http and not https. I’m thinking that I probably have to do some sort of configuration on my container to get SSL to work, but that is where I am stuck right now. I will upload screenshots of my Dockerfile, docker-compose and my Apache conf file. Any help regarding this will be greatly appreciated.
Apache conf file
<VirtualHost *:80>
ServerName x.y.z
ServerAlias x.y.z
ServerAdmin em@i.l
ProxyPass / http://127.0.0.1:9999/
ProxyPassReverse / http://127.0.0.1:9999/
ErrorLog ${APACHE_LOG_DIR}/ods_error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/ods_access.log combined
# Redirect http to https
Redirect / https://x.y.zr$1
RedirectMatch 301 (.*) https:/x.y.z$1
</VirtualHost>
<VirtualHost *:443>
ServerName x.y.z
ServerAlias x.y.z
ServerAdmin em@i.l
# Enable/Disable SSL for this virtual host.
SSLEngine On
SSLProxyEngine On
# Web root
ProxyPass / http://127.0.0.1:9999/
ProxyPassReverse / http://127.0.0.1:9999/
<Location />
ProxyPassReverse /
Options FollowSymLinks
Require all granted
</Location>
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
# Log configuration
ErrorLog ${APACHE_LOG_DIR}/ods-error.log
CustomLog ${APACHE_LOG_DIR}/ods-access.log combined
# Self signed SSL Certificate file
SSLCertificateFile /etc/apache2/ssl/certs/cert.crt
SSLCertificateKeyFile /etc/apache2/ssl/private/cert.key
</VirtualHost>
Dockerfile
FROM python:3.5-alpine
RUN adduser -D ods
WORKDIR /home/ODS
COPY requirements.txt requirements.txt
RUN python -m venv venv
RUN venv/bin/pip install --upgrade pip
RUN apk add make automake gcc g++ subversion python3-dev
RUN venv/bin/pip install -r requirements.txt
RUN venv/bin/pip install gunicorn
COPY ODSPR ODSPR
COPY boot.sh run.py ./
RUN chmod +x boot.sh
ENV FLASK_APP ODSPR/__init__.py
RUN chown -R ods:ods ./
USER ods
EXPOSE 9999
EXPOSE 80
EXPOSE 443
ENTRYPOINT ["./boot.sh"]
docker-compose
version: '2'
services:
db:
image: mysql
ports:
- "9997:3306"
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: v13ws0n1c!
MYSQL_USER: ods_user
MYSQL_PASSWORD: 0D5PR@5235150
MYSQL_DATABASE: ODSPR
volumes:
- ./db:/docker-entrypoint-initdb.d
app:
build: .
ports:
- "9999:9999"
depends_on:
- db