我的NGINX配置
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
root /usr/share/nginx/html;
index index.html index.htm;
location / {
try_files $uri $uri/ /index.html =404;
}
}
}
我的Dockerfile
FROM nginx:1.11-alpine
COPY nginx.conf /etc/nginx/nginx.conf
ADD ./dist/ /usr/share/nginx/html
将此作为图像并以直接IP和端口号运行后正常运行。
添加到负载均衡器后,它无法正常工作。
我的负载均衡器NGINX
upstream ui-service{
server containerip:80;
}
server {
listen 80;
server_name xxxxxx.com;
location /group-management-ui/ {
proxy_pass http://ui-service;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
问题是解决断言:
我的网址:
https://xxxxxx.com/group-management-ui/
但是尝试从大约不同的文件夹中解析断言
https://xxxxxx.com/assets/css/bootstrap.min.css
我尝试添加基础以匹配此
<base href="/group-management-ui">
但没有运气...... :(