Home  >  Article  >  Backend Development  >  Domain + subdomain IIS deployment

Domain + subdomain IIS deployment

PHPz
PHPzforward
2024-02-09 21:50:09795browse

Domain + subdomain IIS deployment

php editor Strawberry introduces domain subdomain IIS deployment to you, which is a method of configuring multiple domain names and subdomain names on the IIS server. Through flexible configuration of domain names and sub-domain names, multiple websites can be run on the same server, improving server utilization. During the deployment process, IIS needs to be set up and configured accordingly to ensure that each domain name and subdomain name can be accessed normally. This deployment method not only facilitates the management and maintenance of multiple websites, but also improves user experience and website usability.

Question content

I have two websites. The first is asp.net core web ui. Followed by golang api. I also bought a domain name. foo.bar (for example). I need two websites:

  1. foo.bar - asp.net user interface
  2. api.foo.bar - go api

How to deploy it on iis? My go-server works on port 8080. I try to create two sites:

  1. Host name is empty
  2. Hostname: api.foo.bar

And foo.bar (ui) works

I also tried using iis rules to redirect api-traffic to port 8080 but it didn't work. For api.foo.bar I only get error 404. The only result I get is that api.foo.bar:8080 is opened correctly from the server's browser.

Solution

I created two websites:

  1. foo.bar (for asp.net ui), hostname is empty;
  2. Hostname: api.foo.bar for api.

Then I put the rewrite rules into api-site's web.config:

<rewrite>
    <rules>
      <remove name="ReverseProxyInboundRule1" />
      <rule name="ReverseProxyInboundRule1" patternSyntax="Wildcard" stopProcessing="true">
          <match url="*" />
          <action type="Rewrite" url="http://localhost:8080/{R:0}" />
      </rule>
    </rules>
</rewrite>

everything is normal

The above is the detailed content of Domain + subdomain IIS deployment. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:stackoverflow.com. If there is any infringement, please contact admin@php.cn delete