nothing works, all is broken, dammit

This commit is contained in:
hugo gogo
2022-09-17 17:00:07 +02:00
parent 96193494a4
commit a676b6cffe
14 changed files with 700 additions and 111 deletions

View File

@@ -1,14 +1,11 @@
FROM debian:buster
RUN apt update && \
apt install -y nginx openssl && \
rm -rf /var/lib/apt/lists/*
# for debug
#RUN apt install -y procps vim
RUN apt update && apt install -y \
nginx openssl
RUN rm -rf /var/lib/apt/lists/*
# create ssl certificate
RUN openssl req -newkey rsa:2048 -nodes -x509 \
RUN openssl req -newkey rsa:2048 -nodes -x509 -days 365 \
-keyout /etc/ssl/private/hulamy.42.fr.key -out /etc/ssl/certs/hulamy.42.fr.crt \
-subj "/C=fr/ST=ile-de-france/L=paris/O=42/OU=inception/CN=hulamy.42.fr"
@@ -16,11 +13,9 @@ RUN openssl req -newkey rsa:2048 -nodes -x509 \
COPY ./conf/nginx.conf /etc/nginx/
COPY ./conf/inception_nginx.conf /etc/nginx/conf.d/
# for test
COPY ./conf/index.html /data/www/
COPY ./conf/https/index.html /data/wwws/
CMD [ "nginx", "-g", "daemon off;" ]
ENTRYPOINT [ "nginx", "-g", "daemon off;" ]
#

View File

@@ -1 +0,0 @@
you are on https connection, yeah

View File

@@ -1,29 +1,31 @@
# doc : https://nginx.org/en/docs/dirindex.html
server {
listen 80;
listen [::]:80;
listen 443 ssl; # for ipv4, on port 443, specifying that accepted connections should works in ssl mode
listen [::]:443 ssl; # for ipv6
server_name hulamy.42.fr;
root /data/www/;
ssl_certificate /etc/ssl/certs/hulamy.42.fr.crt; # specifies the file with the ssl certificate (self signed here) generated by openssl
ssl_certificate_key /etc/ssl/private/hulamy.42.fr.key; # specifies the file with the secret key of the certificate
# switch between two following tests configurations
location / { try_files $uri /index.html; } # try files then redirect to index.html (https://nginx.org/en/docs/http/ngx_http_core_module.html#try_files)
# return 301 https://$host$request_uri; # redirect on https
root /var/www/html/; # contains default nginx index.nginx-debian.html
index index.html index.php; # defines files that will be used as index (https://nginx.org/en/docs/http/ngx_http_index_module.html)
location / {
try_files $uri $uri/ =404; # from /etc/nginx/sites-enabled/default : First attempt to serve request as file, then as directory, then fall back to displaying a 404
root /data/www/;
}
# pass PHP scripts to FastCGI (PHP-FPM) server
location ~ \.php$ {
fastcgi_pass wordpress:9000;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $uri =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi.conf;
fastcgi_index index.php;
}
}
#server {
# listen 443 ssl; # for ipv4, on port 443, specifying that accepted connections should works in ssl mode
# listen [::]:443 ssl; # for ipv6
# server_name hulamy.42.fr;
# ssl_certificate /etc/ssl/certs/hulamy.42.fr.crt; # specifies the file with the ssl certificate (self signed here) generated by openssl
# ssl_certificate_key /etc/ssl/private/hulamy.42.fr.key; # specifies the file with the secret key of the certificate
#
# root /var/www/html/; # contains default nginx index.nginx-debian.html
# index index.html index.htm index.nginx-debian.html index.php; # defines files that will be used as index (https://nginx.org/en/docs/http/ngx_http_index_module.html)
#
# location / {
# try_files $uri $uri/ =404; # from /etc/nginx/sites-enabled/default : First attempt to serve request as file, then as directory, then fall back to displaying a 404
# # for test
# root /data/wwws/;
# }
#}

View File

@@ -1 +1 @@
you are on http connection, there is nothing for you there, you should go to https
hello world !