简体   繁体   中英

Different web server on one domain

I have two web sites:

  • (a) is built with yesod web framework (and running on port A)
  • (b) is built with wordpress (and running on port B)

I want to publish these sites as following:

  • foo.com/wp refers to (b)
  • Other pages on foo.com refers to (a)

Is it possible?

You can use (a) and (b) behind a proxy (c) -- NGINX is my personal preferred server for that purpose because it is insanely fast and good on resources.

http://nginx.org/en/docs/beginners_guide.html#proxy

You'd do something like this:

server {
    location / {
        proxy_pass http://localhost:{port for a}/;
    }

    location /wp {
        proxy_pass http://localhost:{port for b}/;
    }
}

** note that {b} will know that it is at /wp. If you need the backend server to think that it's at root (/), you can do it with a rewrite (also in the NGINX docs)

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