一、该问题的重现步骤是什么?
nginx 配置
user root;
worker_processes 1;
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;
upstream gateway {
server blade-gateway;
}
server {
listen 80;
server_name hwt.stoneboss.vip;
root /usr/share/nginx/html;
location / {
}
location ^~/api {
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_buffering off;
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://gateway;
}
location /image/ {
root /static/file;
autoindex on;
}
location /file/ {
root /static/file;
autoindex on;
}
}
}
2. dockerfile打包配置
FROM nginx:stable-alpine-perl
RUN rm -f /etc/nginx/nginx.conf \
&& rm -f /etc/nginx/conf.d/default.conf \
&& mkdir -p /static/file/image \
&& mkdir -p /static/file
COPY docker/nginx.k8s.conf /etc/nginx/nginx.conf
EXPOSE 80
COPY ./dist /usr/share/nginx/html
ENTRYPOINT ["nginx", "-g", "daemon off;"]
3.
图片地址访问:http://hwt.stoneboss.vip/image/2-2021100802423139.jpg
直接报404
二、你期待的结果是什么?实际看到的又是什么?
三、你正在使用的是什么产品,什么版本?在什么操作系统上?
四、请提供详细的错误堆栈信息,这很重要。
五、若有更多详细信息,请在下面提供。
扫一扫访问 Blade技术社区 移动端