我使用的是docker映像linuxserver/letsencrypt。
我正在尝试运行一个静态网站与节点子域。
我nginx配置是:
server {
listen 80;
listen [::]:80;
server_name _;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
root /config/www;
index index.html index.htm index.php;
server_name dreamingoftech.uk www.dreamingoftech.uk;
# all ssl related config moved to ssl.conf
include /config/nginx/ssl.conf;
# client_max_body_size 0;
# location / {
# try_files $uri $uri/ /index.html /index.php?$args =404;
# }
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
#
# root /config/www;
# index index.html index.htm index.php;
#
server_name api.dreamingoftech.uk;
#
include /config/nginx/ssl.conf;
#
# include /config/nginx/ldap.conf;
#
# client_max_body_size 0;
#
location / {
# include /config/nginx/proxy.conf;
# resolver 127.0.0.1 valid=30s;
proxy_pass http://localhost:4000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
# proxy_set_header Host api.dreamingoftech.uk;
proxy_cache_bypass $http_upgrade;
}
}
我希望能得到一些帮助来解决这个问题。我已经将我的应用程序停靠在一起,并让它们在同一个虚拟网络上运行。
我还可以从服务器 curl api主页,这样我就知道它已经启动了。
静态网站工作正常,但我得到了一个502错误的子域。
2条答案
按热度按时间pes8fvy91#
您必须先检查http://localhost:4000在载入时是否显示网页。如果没有,就会造成错误。而且没有配置索引页或根目录,以防nginx无法找到它
nzk0hqpo2#
终于想通了。
我不得不在我的docker-compose文件中添加一个网桥。
然后,在Nginx上游配置中,我必须引用节点应用程序的docker名称,而不是localhost