wip
This commit is contained in:
parent
aa96d79e47
commit
1bc33ab912
28 changed files with 94 additions and 18 deletions
15
nginx/15-local-resolvers.envsh
Executable file
15
nginx/15-local-resolvers.envsh
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
# if $NGINX_RESOLVERS set to local, set it to the local resolvers from /etc/resolv.conf and export it
|
||||
|
||||
set -eu
|
||||
|
||||
LC_ALL=C
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
NGINX_RESOLVERS=$(awk 'BEGIN{ORS=" "} $1=="nameserver" {if ($2 ~ ":") {print "["$2"]"} else {print $2}}' /etc/resolv.conf)
|
||||
# remove trailing space
|
||||
NGINX_RESOLVERS="${NGINX_RESOLVERS% }"
|
||||
echo "_${NGINX_RESOLVERS}_"
|
||||
|
||||
export NGINX_RESOLVERS
|
||||
|
|
@ -4,6 +4,7 @@ set -e
|
|||
|
||||
ME=$(basename "$0")
|
||||
|
||||
echo "_{$NGINX_LOCAL_RESOLVERS}_"
|
||||
entrypoint_log() {
|
||||
if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
|
||||
echo "$@"
|
||||
|
|
@ -19,7 +20,7 @@ auto_template() {
|
|||
entrypoint_log "$ME: ERROR: $template_dir exists, but is not writable"
|
||||
return 0
|
||||
fi
|
||||
find "$template_dir" -follow -type f -print | while read -r template; do
|
||||
find "$template_dir" -follow -type f -name '*.conf' -print | while read -r template; do
|
||||
entrypoint_log "$ME: adding $suffix to $template"
|
||||
mv "$template" "$template$suffix"
|
||||
done
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2025/06/12 16:42:38 by maiboyer #+# #+# #
|
||||
# Updated: 2025/06/12 18:15:38 by maiboyer ### ########.fr #
|
||||
# Updated: 2025/06/16 16:26:48 by maiboyer ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
|
|
@ -20,6 +20,6 @@ RUN mkdir -p /etc/nginx/ && \
|
|||
-keyout /etc/ssl/private/nginx-selfsigned.key \
|
||||
-out /etc/ssl/certs/nginx-selfsigned.crt \
|
||||
-subj "/C=FR/OU=student/CN=${NGINX_DOMAIN}"
|
||||
|
||||
COPY ./15-local-resolvers.envsh /docker-entrypoint.d/
|
||||
COPY ./17-add-template-prefix.sh /docker-entrypoint.d/
|
||||
COPY ./conf /etc/nginx/templates
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ server {
|
|||
charset UTF-8;
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
resolver $NGINX_RESOLVERS;
|
||||
server_name $NGINX_DOMAIN;
|
||||
|
||||
if ($host = $NGINX_DOMAIN) {
|
||||
|
|
@ -17,6 +17,7 @@ server {
|
|||
listen [::]:443 ssl;
|
||||
listen 443 ssl;
|
||||
server_name $NGINX_DOMAIN;
|
||||
resolver $NGINX_RESOLVERS;
|
||||
|
||||
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
|
||||
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
|
||||
|
|
|
|||
4
nginx/conf/locations/icons.conf
Normal file
4
nginx/conf/locations/icons.conf
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
location /api/icons {
|
||||
rewrite ^/api/icons/(.*) /$1 break;
|
||||
proxy_pass http://icons-service/$uri$is_args$args;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue