Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在/admin而不是/load上使用NGINX为react应用程序提供服务,但不呈现应用程序_Javascript_Reactjs_Nginx_Docker_Kubernetes - Fatal编程技术网

Javascript 在/admin而不是/load上使用NGINX为react应用程序提供服务,但不呈现应用程序

Javascript 在/admin而不是/load上使用NGINX为react应用程序提供服务,但不呈现应用程序,javascript,reactjs,nginx,docker,kubernetes,Javascript,Reactjs,Nginx,Docker,Kubernetes,通过Kubernetes上的NGINX docker容器为react应用程序提供服务时遇到了一些问题 终点是活的,我可以看到它加载了它的资源…但就是这样。它不会呈现任何东西。以下是Dockerfile: FROM node:8.1.0-alpine AS builder RUN mkdir /home/app WORKDIR /home/app COPY package.json . RUN npm install COPY . . RUN npm run build # ----

通过Kubernetes上的NGINX docker容器为react应用程序提供服务时遇到了一些问题

终点是活的,我可以看到它加载了它的资源…但就是这样。它不会呈现任何东西。以下是Dockerfile:

FROM node:8.1.0-alpine AS builder

RUN mkdir /home/app

WORKDIR /home/app

COPY package.json .

RUN npm install

COPY . .

RUN npm run build

# ---- Base Release Image
FROM nginx:1.13.1-alpine

COPY ./config/nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /home/app/build /usr/share/nginx/html
以下是我用于NGINX的default.conf:

server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;

    location /admin {
        alias /usr/share/nginx/html;
        index  index.html index.htm;
        try_files $uri $uri/ /index.html;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}
如果在除/之外的任何其他路径中提供此服务,则不会渲染。只要我在任何相对路径上提供它,即使它加载了内容,它也会退出

我不知道还能尝试什么