add nginx container

This commit is contained in:
arslantu 2024-04-13 20:55:07 +08:00
parent 040a556d4b
commit fa5c6f01f9
7 changed files with 117 additions and 0 deletions

View File

0
nginx/data/html/.gitkeep Normal file
View File

19
nginx/data/html/50x.html Normal file
View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title>Error</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>An error occurred.</h1>
<p>Sorry, the page you are looking for is currently unavailable.<br/>
Please try again later.</p>
<p>If you are the system administrator of this resource then you should check
the error log for details.</p>
<p><em>Faithfully yours, nginx.</em></p>
</body>
</html>

View File

@ -0,0 +1,23 @@
<!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>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>

0
nginx/data/logs/.gitkeep Normal file
View File

63
nginx/data/nginx.conf Normal file
View File

@ -0,0 +1,63 @@
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include 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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
upstream backend_servers{
server localhost:8000;
server localhost:8001;
}
server {
listen 80;
server_name example.com;
absolute_redirect off;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://backend_servers/;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}

12
nginx/docker-compose.yml Normal file
View File

@ -0,0 +1,12 @@
version: '3'
services:
nginx:
image: nginx:latest
container_name: nginx
restart: unless-stopped
network_mode: host
volumes:
- ./data/conf.d:/etc/nginx/conf.d
- ./data/nginx.conf:/etc/nginx/nginx.conf
- ./data/logs:/var/log/nginx
- ./data/html:/var/www/html