mirror of
https://github.com/Noratrieb/vps.git
synced 2026-01-14 08:45:02 +01:00
localhost nginx
This commit is contained in:
parent
ec93c7df6c
commit
5ec5a3e64e
2 changed files with 42 additions and 5 deletions
26
nginx/nginx.local.conf
Normal file
26
nginx/nginx.local.conf
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
events {
|
||||||
|
worker_connections 512;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
|
||||||
|
server_name "nilstrieb.dev";
|
||||||
|
|
||||||
|
return 302 http://blog.nilstrieb.dev$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
|
||||||
|
server_name "private-docker-registry.nilstrieb.dev";
|
||||||
|
|
||||||
|
location / {
|
||||||
|
return 404 'No registry here...';
|
||||||
|
#proxy_pass http://registry:5000/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server_tokens off;
|
||||||
|
}
|
||||||
21
nginx/run.sh
21
nginx/run.sh
|
|
@ -2,13 +2,24 @@
|
||||||
|
|
||||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
|
|
||||||
|
if [ $STAGE = "localhost" ] ;
|
||||||
|
then
|
||||||
|
echo "INFO Running on localhost"
|
||||||
|
NGINX_CONF="nginx.local.conf"
|
||||||
|
CERT_VOLUME=""
|
||||||
|
else
|
||||||
|
echo "INFO Running on prod"
|
||||||
|
NGINX_CONF="nginx.conf"
|
||||||
|
CERT_VOLUME="-v=/etc/letsencrypt:/etc/nginx/certs"
|
||||||
|
fi
|
||||||
|
|
||||||
if docker container inspect nginx > /dev/null 2>&1 ;
|
if docker container inspect nginx > /dev/null 2>&1 ;
|
||||||
then
|
then
|
||||||
echo "nginx container exists already..."
|
echo "INFO nginx container exists already..."
|
||||||
else
|
else
|
||||||
docker run -d -p 80:80 -p 443:443 --restart=always --name nginx \
|
docker run -d -p 80:80 -p 443:443 --restart=always --name=nginx \
|
||||||
-v "$SCRIPT_DIR/nginx.conf:/etc/nginx/nginx.conf:ro" \
|
-v="$SCRIPT_DIR/$NGINX_CONF:/etc/nginx/nginx.conf:ro" \
|
||||||
-v "/etc/letsencrypt:/etc/nginx/certs" \
|
$CERT_VOLUME \
|
||||||
--net internal \
|
--net=internal \
|
||||||
nginx:latest
|
nginx:latest
|
||||||
fi
|
fi
|
||||||
Loading…
Add table
Add a link
Reference in a new issue