简体   繁体   中英

How may implement subdomains using docker, a config file for nginx and building react on a container?

lovely people of SO, I have this project where I'm doing a server based on node/express and using react in a small node container for the deployed site, everything is passed upon nginx for reverse proxy, i have searched for a way of using subdomains for my dashboard.example.com, but can't seem to work it out, no tutorials anywhere or code examples of how to achieve this, im no new to the MERN stack but nginx and docker.

I have tried using vhost, couldn't make it work as a subdomain, tried the npm express-subdomain, didn't work as expected either, how would you do this?

  listen 8080;
      location @LandingPage {
      proxy_pass http://LandingPage:80;
  }

# this one down here doesn't work as expected neither

     location /gql/ {
      proxy_pass http://server:1000/graphql;
  }
}

had been mad last 2 weeks with the issue with the subdomain that I deleted all my middlewares and trash code that didn't get to work, please help

expected results: dashboard.landingpage.com working and configured

bonus: sending my queries to gql.landingpage.com, or landingpage.com/gql

actual results: landingpage.com working on proxy

i just created this monster, its an express app with a subdomain and an automatic build for the public folders, now i only need to proxy pass 1

https://github.com/sabasm/node-express-react-and-reactSubdomain/tree/master

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM