Skip to content
Snippets Groups Projects
Commit 046cfa0d authored by Quentin Bramas's avatar Quentin Bramas
Browse files

http only is possible

parent 6d79ae4f
Branches
No related merge requests found
Pipeline #177302 passed with stage
in 48 seconds
FROM nginx:alpine3.18
ENV HOSTNAME=localhost
ENV HTTP_HOST=localhost
ENV HTTPS_HOST=localhost
ENV USE_SSL=0
RUN apk update \
&& apk add openssl
RUN mkdir -p /etc/nginx/ssl
RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/privkey.key -out /etc/nginx/ssl/fullchain.crt -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=localhost"
COPY nginx.conf /etc/nginx/templates/default.conf.template
COPY index.html /usr/share/nginx/html/index.html
......@@ -2,17 +2,29 @@
server {
listen 80;
listen [::]:80;
server_name ${HOSTNAME};
return 301 https://$host$request_uri;
server_name ${HTTP_HOST};
root /usr/share/nginx/html;
index index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
error_page 404 /index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
server {
listen [::]:443 ssl;
listen 443 ssl http2;
listen 443 ssl;
root /usr/share/nginx/html;
server_name ${HOSTNAME};
server_name ${HTTPS_HOST};
index index.html;
error_log /var/log/nginx/error.log;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment