我实际上正在尝试将nginx用作docker中的odoo代理。 我创建了一个名为odoo_nginx_1的容器,并将此代码添加到/etc/nginx/conf.d/fefault.conf
server {
listen 80 ;
server_name erabakerydesign.com ;
location = / {
return 301 http://$server_name/web?db=EraBakeryDesign;
}
location / {
proxy_pass http://192.168.16.1:8069;
proxy_next_upstream error timeout invalid_header invalid_header http_500 http_502 http_503 http_504 ;
proxy_redirect off ;
# set headers
proxy_set_header Host $host ;
proxy_set_header X-Real-IP $remote_addr ;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
proxy_set_header X-Forwarded-Proto http ;
}
access_log /var/log/nginx/odoo-ssl-access.log ;
error_log /var/log/nginx/odoo-ssl-error.log ;
}
,在堆栈中,我使用了这个组合:
version: '2'
services:
nginx:
image: nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx:/etc/nginx/conf.d
command: [nginx-debug, '-g', 'daemon off;']
web:
image: odoo_enterprise:13
depends_on:
- db
ports:
- "8069:8069"
volumes:
- web-data:/var/lib/odoo
- ./config:/etc/odoo
- ./addons:/mnt/extra-addons
environment:
- HOST=db
- USER=odoo
- PASSWORD=odoo
networks:
odoo:
ipv4_address: 192.168.16.3
db:
image: postgres:10
environment:
- POSTGRES_DB=postgres
- POSTGRES_PASSWORD=odoo
- POSTGRES_USER=odoo
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- db-data:/var/lib/postgresql/data/pgdata
networks:
odoo:
ipv4_address: 192.168.16.2
networks:
odoo:
driver: bridge
ipam:
config:
- subnet: 192.168.16.0/20
gateway: 192.168.16.1
但是,当尝试访问我的网站时,出现此错误[504网关超时nginx / 1.15.1]
此配置以前可以使用,但以后不再可用。