Nginx served react app cannot be reached

verhoczkimarton
TRIAL

a year ago

I have a react app that is dockerized with the following dockerfile:

FROM node:20 as base

WORKDIR /usr/src/app

COPY package.json package-lock.json ./

RUN npm ci --silent

COPY . .

FROM base as development

EXPOSE 5173

FROM base as production-builder

RUN npm run build

FROM nginx:latest as production

COPY --from=production-builder /usr/src/app/dist /usr/share/nginx/html

COPY nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 5173

When deploying this service and exposing port 5173 the service is not reachable.

View Deploy details

ⓘ Deployment information is only viewable by project members and Railway employees.

Solved

4 Replies

verhoczkimarton
TRIAL

a year ago

This is my nginx config:

```

server {

  listen 5173;

  location / {

    root /usr/share/nginx/html;

    index index.html;

  }

}

```


a year ago

Hey, It looks like your deployment works and is accessible via its domain now?


verhoczkimarton
TRIAL

a year ago

Thanks Brody, it seems to be okay now.

Any ideas from your logs on what happened? So this doesnt occur again.


a year ago

Seems like you were listening on the wrong port.


Status changed to Solved brody 11 months ago