Add redirection from HTTP to HTTPS
Update Dockerfile so the container can run in OpenShift
| | |
| | | ## End of SSL |
| | | |
| | | RUN touch /run/nginx.pid \ |
| | | && chgrp -R nginx /var/log/nginx /run/nginx.pid \ |
| | | && chgrp -R 0 /var/log/nginx /run/nginx.pid \ |
| | | && chmod -R g+rwx /var/log/nginx /run/nginx.pid |
| | | |
| | | COPY src/ /usr/share/nginx/html |
| | | |
| | | EXPOSE 8080 8443 |
| | | |
| | | USER nginx |
| | | USER 1001 |
| | | |
| | | CMD nginx -g "daemon off;" |
| | |
| | | # COPY nginx/dhparam.pem /etc/ssl/conf/dhparam.pem |
| | | # COPY nginx/conf.d/ssl.conf /etc/nginx/conf.d/ssl.conf |
| | | ``` |
| | | 2. In `nginx/nginx.conf`comment line 38 & 66: |
| | | 2. In `nginx/nginx.conf`comment line 38 & 66-67: |
| | | ``` |
| | | # include /etc/nginx/conf.d/*.conf; |
| | | ... |
| | | # error_page 497 https://$host:8443/$request_uri; |
| | | # error_page 497 https://$host:8443$request_uri; |
| | | # return 301 https://$host:8443$request_uri; |
| | | ``` |
| | | 3. Rebuild the image: |
| | | ``` |
| | |
| | | error_page 500 502 503 504 /50x.html; |
| | | location = /50x.html { |
| | | } |
| | | # Comment the following to disable SSL support |
| | | error_page 497 https://$host:8443/$request_uri; |
| | | # Comment the following lines to disable SSL support |
| | | error_page 497 https://$host:8443$request_uri; |
| | | return 301 https://$host:8443$request_uri; |
| | | } |
| | | |
| | | } |