You've already forked dockerfiles
mirror of
https://github.com/vimagick/dockerfiles.git
synced 2025-07-15 01:14:25 +02:00
update
This commit is contained in:
102
nginx/README.md
102
nginx/README.md
@ -5,7 +5,9 @@ nginx
|
|||||||
IMAP protocols, as well as a load balancer, HTTP cache, and a web server
|
IMAP protocols, as well as a load balancer, HTTP cache, and a web server
|
||||||
(origin server).
|
(origin server).
|
||||||
|
|
||||||
## docker-compose.yml
|
## Static Website
|
||||||
|
|
||||||
|
docker-compose.yml
|
||||||
|
|
||||||
```
|
```
|
||||||
nginx:
|
nginx:
|
||||||
@ -13,7 +15,101 @@ nginx:
|
|||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
volumes:
|
volumes:
|
||||||
- nginx/nginx.conf:/etc/nginx/nginx.conf
|
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||||
- html:/usr/share/nginx/html
|
- ./html:/usr/share/nginx/html
|
||||||
restart: always
|
restart: always
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Website Proxy
|
||||||
|
|
||||||
|
docker-compose.yml
|
||||||
|
|
||||||
|
```
|
||||||
|
nginx:
|
||||||
|
image: nginx:latest
|
||||||
|
volumes:
|
||||||
|
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||||
|
- ./nginx/sites-enabled/default:/etc/nginx/sites-enabled/default
|
||||||
|
- ./nginx/htpasswd:/etc/nginx/htpasswd
|
||||||
|
net: host
|
||||||
|
restart: always
|
||||||
|
```
|
||||||
|
|
||||||
|
> Password file can be generated by:
|
||||||
|
>> `htpasswd -b -c ./nginx/htpasswd username password`
|
||||||
|
|
||||||
|
nginx.conf
|
||||||
|
|
||||||
|
```
|
||||||
|
user nginx;
|
||||||
|
worker_processes 4;
|
||||||
|
|
||||||
|
error_log /var/log/nginx/error.log warn;
|
||||||
|
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;
|
||||||
|
include /etc/nginx/sites-enabled/*;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
default
|
||||||
|
|
||||||
|
```
|
||||||
|
server {
|
||||||
|
listen 80 default;
|
||||||
|
server_name _;
|
||||||
|
return 301 http://blog.foobar.site/;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name blog.foobar.site blog.datageek.info;
|
||||||
|
location / {
|
||||||
|
proxy_pass http://127.0.0.1:6109;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name wiki.foobar.site wiki.datageek.info;
|
||||||
|
location / {
|
||||||
|
auth_basic restricted;
|
||||||
|
auth_basic_user_file /etc/nginx/htpasswd;
|
||||||
|
proxy_pass http://127.0.0.1:8000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name iot.foobar.site iot.datageek.info;
|
||||||
|
location / {
|
||||||
|
proxy_pass http://127.0.0.1:1880;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Reference in New Issue
Block a user