feat: default nginx config
This commit is contained in:
parent
ee4b9a6ee6
commit
b9950596bb
6 changed files with 137 additions and 0 deletions
12
servers/skel/docker-compose.d/custom/nginx/Dockerfile
Normal file
12
servers/skel/docker-compose.d/custom/nginx/Dockerfile
Normal file
|
@ -0,0 +1,12 @@
|
|||
FROM nginx:alpine
|
||||
|
||||
RUN apk add \
|
||||
certbot \
|
||||
certbot-nginx
|
||||
|
||||
COPY content /usr/share/nginx/html
|
||||
COPY conf.d /etc/nginx
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
COPY entrypoint.sh /entrypoint
|
||||
ENTRYPOINT [ "sh", "/entrypoint" ]
|
|
@ -0,0 +1,24 @@
|
|||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
# default html page
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
proxy_pass http://$host$request_uri;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Welcome to nginx!</title>
|
||||
<style>
|
||||
html {
|
||||
color-scheme: light dark;
|
||||
}
|
||||
|
||||
body {
|
||||
width: 35em;
|
||||
margin: 0 auto;
|
||||
font-family: Tahoma, Verdana, Arial, sans-serif;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Welcome to nginx!</h1>
|
||||
<span>Seems like this server is not setup!</span>
|
||||
</body>
|
||||
|
||||
</html>
|
22
servers/skel/docker-compose.d/custom/nginx/entrypoint.sh
Normal file
22
servers/skel/docker-compose.d/custom/nginx/entrypoint.sh
Normal file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/sh
|
||||
|
||||
trap exit TERM
|
||||
|
||||
if [ -n "${CERTBOT_DOMAINS}" ]; then
|
||||
echo "registering domains..."
|
||||
|
||||
certbot --nginx -n --agree-tos \
|
||||
-m "${CERTBOT_EMAIL}" \
|
||||
-d "${CERTBOT_DOMAINS}"
|
||||
|
||||
while :; do
|
||||
echo "renewing domains..."
|
||||
certbot --nginx -n renew
|
||||
nginx -s reload
|
||||
sleep 12h & wait $!
|
||||
done &
|
||||
else
|
||||
echo "skipping certbot due to no domains!"
|
||||
fi
|
||||
|
||||
exec nginx -g "daemon off;"
|
32
servers/skel/docker-compose.d/custom/nginx/nginx.conf
Normal file
32
servers/skel/docker-compose.d/custom/nginx/nginx.conf
Normal file
|
@ -0,0 +1,32 @@
|
|||
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
23
servers/skel/docker-compose.d/docker-compose.yml
Normal file
23
servers/skel/docker-compose.d/docker-compose.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
# I'm very comfortable in this version, therefore it's the standard
|
||||
version: '2.2'
|
||||
|
||||
services:
|
||||
# default nginx setup
|
||||
nginx:
|
||||
build: custom/nginx
|
||||
environment:
|
||||
CERTBOT_EMAIL: "webmaster@ixvd.net"
|
||||
CERTBOT_DOMAINS: ""
|
||||
ports:
|
||||
- 8080:80
|
||||
- 443:443
|
||||
networks:
|
||||
- proxy
|
||||
|
||||
# Here the default networks are defined
|
||||
networks:
|
||||
proxy:
|
||||
external: true
|
||||
internal:
|
||||
external: true
|
||||
|
Loading…
Reference in a new issue