How to: Mulitple sites on one account

Discussion in 'Site Programming, Development and Design' started by elitemike, Jul 23, 2010.

  1. ComputerMan

    ComputerMan Winhost Staff

    You can host multiple web sites within one account/site. We offer unlimited domain pointers so you can add as many domains as you wish to your site through Control Panel. You can then programmatically redirect the additional domains to whichever subdirectory you choose. You can set the subdirectory as its own application starting point using the Application Starting Point tool in Control Panel.

    Having said that, there are some distinct disadvantages to hosting multiple web sites in this manner, and you may want to consider these points before you load up a site with several domains:

    - All domains within a site are in one shared application pool (they all share the same memory allocation).
    - You do not get separate stats for each domain.
    - You only get email alias service for the domain pointers, not POP accounts.
    - You don't get the full set of tools for each domain.

    Alternatively, if you want the full scope of features and tools for each domain, you can sign up each domain name as separate Basic or Max site through Control Panel.

    We host each hosting account in its unique application pool/process. To ensure server stability we recycle the application if any of the following conditions are met:

    1) More than 20 minutes of idle time (no HTTP request in 20 minutes)
    2) The application uses more than 100 MB of memory for the Basic plan and 200 MB of memory for the Max and 300 MB of memory for the Ultimate plan.
    3) The application uses more than 70% of CPU resources for more than 5 minutes


    The choice is really yours to make. We do provide you with a domain pointer service. So you can direct a domain to the hosting account site. But take a note about our application pool and the limits we have in place. I would suggest that you run all the applications that you are planning to host with us on your local server / computer. Then set the same limitations on your local level to see if you will hit one of the above settings.

    The only way to get around the 1st limitation. "More than 20 minutes of idle time (no HTTP request in 20 minutes)" is to your our Scheduled Task Tool. But to use the tool you will need to upgrade to our Ultimate hosting plan.

    With the Scheduled task manager you can make a http request to a page on your site every 15 mins.
     
    Last edited by a moderator: Oct 14, 2015
  2. Use pingdom or similar service to keep your site alive

    For the record, I have no affiliation with any of these services.

    I believe if we have one of them ping our site at a reasonable interval, that will avoid the 20-minute timeout issue....correct?
     
  3. I feel ripped off

    I feel very ripped off by this policy! One site only? What sort of BS is this? Your signup pages say nothing about limiting the number of sites. I assumed that each of my sites would have its own dedicated area and not share it. I will be cancelling immediately.

    WHAT A RIPOFF!!!
     
  4. curtis

    curtis Winhost Staff

    I'm sorry you feel that way. You purchase a hosting plan and we give you space for it. Then you can run as many websites within it as you want. That's pretty much how all the multidomain hosting works out there.
     
  5. This topic has been very helpful. Thank you. I have one issue though, I am trying to resolve.

    What specific line in the root web.config file or the sub-folder web.config file dictate what will be displayed as the browser url? Reason is, I got everything working except the url displayed in the browser shows mydomain.com instead of www.mydomain.com (or even http://mydomain.com).


    My root web.config (partial) is here:

    <rewrite>
    <rules>
    <clear />
    <rule name="Canonical Host Name Site 1" enabled="true" stopProcessing="true">
    <match url="(.*)" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
    <add input="{HTTP_HOST}" pattern="^www\.mydomain\.com$" />
    </conditions>
    <action type="Redirect" url="http://mydomain.com/{R:1}" />
    </rule>

    <rule name="Site 1" enabled="true" stopProcessing="true">
    <match url="(.*)" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
    <add input="{HTTP_HOST}" pattern="^(www\.)?mydomain\.com$" />
    <add input="{PATH_INFO}" pattern="^/myfolder($|/)" negate="true" />
    </conditions>
    <action type="Rewrite" url="\myfolder\{R:0}" />
    </rule>

    </rules>
    </rewrite>


    My sub-folder web.config (partial) is here:

    <rewrite>
    <outboundRules>
    <rule name="Outgoing - URL paths" preCondition="Not .axd files" enabled="true">
    <match filterByTags="A, Form, Img, Input, Link, Script" pattern="^(?:myfolder|(.*//[_a-zA-Z0-9-\.]*)?/myfolder)(.*)" />
    <conditions>

    </conditions>
    <action type="Rewrite" value="{R:1}{R:2}" />
    </rule>
    <rule name="response_location URL">
    <match serverVariable="RESPONSE_LOCATION" pattern="^(?:myfolder|(.*//[_a-zA-Z0-9-\.]*)?/myfolder)(.*)" />
    <conditions>
    <add input="{URL}" negate="true" pattern="\.axd$" />
    </conditions>
    <action type="Rewrite" value="{R:1}{R:2}" />
    </rule>
    <rule name="response_location querystring">
    <match serverVariable="RESPONSE_LOCATION" pattern="(.*)%2fmyfolder(.*)" />
    <conditions>
    <add input="{URL}" negate="true" pattern="\.axd$" />
    </conditions>
    <action type="Rewrite" value="{R:1}{R:2}" />
    </rule>
    <preConditions>
    <preCondition name="Not .axd files">
    <add input="{URL}" pattern="\.axd" negate="true" />
    </preCondition>
    </preConditions>
    </outboundRules>
    </rewrite>
     
  6. This is mine and i can;t get it working. The smartconnectables.io stuff was related to CloudFlare but the leejones.website is not happy:


    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <rewrite>
    <rules>
    <clear/>

    <!-- Remove www prefix and convert to lower case -->
    <rule name="Remove www prefix"
    enabled="true"
    stopProcessing="true">

    <match url="(.*)" ignoreCase="true"/>

    <conditions logicalGrouping="MatchAll">
    <add input="{HTTP_HOST}" pattern="^www\.(.+)$"/>
    </conditions>

    <action type="Redirect" url="http://{ToLower:{C:1}/{R:0}}" appendQueryString="true" redirectType="Permanent" />

    </rule>

    <!-- leejones.website -->
    <rule name="Rewrite to leejones.website"
    enabled="true"
    stopProcessing="true">

    <match url="(.*)"/>

    <conditions logicalGrouping="MatchAll">
    <add input="{HTTP_HOST}" pattern="^(www\.)?leejones\.website$"/>
    <add input="{PATH_INFO}" pattern="^/leejones($|/)" negate="true"/>
    </conditions>

    <action type="Rewrite" url="\leejones.website\{R:1}" redirectType="Permanent" />

    </rule>

    <!-- smartconnectables -->
    <rule name="Rewrite to smartconnectables.(io|com|co.uk)"
    enabled="true"
    stopProcessing="true">

    <match url="(.*)"/>

    <conditions logicalGrouping="MatchAll">
    <add input="{HTTP_HOST}" pattern="^(www\.)?smartconnectables\.(io|com|co\.uk)$"/>
    <add input="{PATH_INFO}" pattern="^/smartconnectables($|/)" negate="true"/>
    </conditions>

    <action type="Rewrite" url="\smartconnectables.{C:0}\{R:0}" redirectType="Permanent" />

    </rule>

    <!-- CDN
    <rule name="Rewrite to CDN" enabled="true" stopProcessing="true">
    <match url="(Content/(.+)/$" ignoreCase="true" />
    <action type="Redirect" url="http://images.cdn.com/{R:1}" />
    </rule> -->

    <!--
    <rule name="Prevent image hotlinking">
    <match url=".*\.(gif|jpg|png|svg)$"/>
    <conditions>
    <add input="{HTTP_REFERER}" pattern="^$" negate="true" />
    <add input="{HTTP_REFERER}" pattern="^http://smartconnectables\.io/.*$" negate="true" />
    </conditions>
    <action type="Rewrite" url="hotlinkingprohibited" />
    </rule> -->
    </rules>
    </rewrite>
    <urlCompression doStaticCompression="true" doDynamicCompression="true"/>
    </system.webServer>
    </configuration>


    If I hit leejones.website it lists the folders (there's no site there, not yet anyway) and select one of the folders it goes to:

    http://leejones.website/leejones.website/Alfred/

    It's kinda important i get this sorted nd fully understood soon as smartconnectables.(io|com|.co.uk) is all part of a startup and I have meetings which may provide grants and additional funding starting 9am tomorrow morning.

    Please help if you can...

    Thanks,
    Lee.
     
  7. Elshadriel

    Elshadriel Winhost Staff

    Hi Lee,

    That's a lot of rules. I can only help you with rewriting to a sub-directory. Try this rule only for now:

    Code:
    <rewrite>
      <rules>
        <rule name="Rewrite to leejones.website" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^leejones.website$" />
          </conditions>
          <action type="Rewrite" url="Alfred/{R:1}" />
        </rule>
      </rules>
    </rewrite>
    
     
    Michael likes this.
  8. Hi,

    Thanks for helping.. this is my folder structure on your server:

    Ignore the smartconnectables folder with no suffix, it won't delete right now, but that's the least of my problems.


    Screen Shot 2015-10-19 at 01.34.40.png

    smartconnectables.io is the key concern. It's an MVC app but when you try to hit it you get the following:

    Screen Shot 2015-10-19 at 01.40.32.png

    The leejones.website rewrite element was only added as a test which worked, including the removal of the www prefix snd ensuring its lower-case.

    Now I know how to do a code block I'll paste it again without the leejones.website bit and some commented out but there for for trying out in the future stuff removed so its easier to read:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <modules runAllManagedModulesForAllRequests="true"/>
            <rewrite>
                <rules>
                    <clear/>
        
                    <!-- Remove www prefix and convert to lower case -->
                    <rule name="Remove www prefix"
                         enabled="true"
                         stopProcessing="true">
            
                        <match url="(.*)" ignoreCase="true"/>
            
                        <conditions logicalGrouping="MatchAll">
                            <add input="{HTTP_HOST}" pattern="^www\.(.+)$"/>
                        </conditions>
    
                        <action type="Redirect" url="http://{ToLower:{C:1}/{R:0}}" appendQueryString="true" redirectType="Permanent" />
    
                    </rule>
        
    
                    <!-- smartconnectables -->
                    <rule name="Rewrite to smartconnectables.(io|com|co.uk)"
                          enabled="true"
                          stopProcessing="true">
            
                        <match url="(.*)"/>
    
                        <conditions logicalGrouping="MatchAll">
                            <add input="{HTTP_HOST}" pattern="^(www\.)?smartconnectables\.(io|com|co\.uk)$"/>
                            <add input="{PATH_INFO}" pattern="^/smartconnectables($|/)" negate="true"/>
                        </conditions>
    
                        <action type="Rewrite" url="\smartconnectables.{C:0}\{R:0}" redirectType="Permanent" />
    
                    </rule>
        
                </rules>
            </rewrite>
            <urlCompression doStaticCompression="true" doDynamicCompression="true"/>
        </system.webServer>
    </configuration>
    
    Other than a few minor things like the patterned suffixes for .io, .com and .co.uk versions and setting redirectType to Permanent. I see little difference. The only other one is the {PATH_INFO} condition which I read elsewhere was very important.

    Is it possible that because the domain was ordered originally as leejones.website and then I changed the domain to smartconnectables.io has caused a problem. Permissions, ACL etc? Ill try without the path info now.

    The other important factor is I'd setup CloudFlare to host it's DNS and server the static files. I've paused that now and its now pointing directly at your server IP wise. I'm going to CNAME to cdn. to my CloudFlare server location and do rewrites for the Content and Scripts folders. No point in doing Views as they get compiled into temporary assemblies in the application's temporary folder but I think there's an option in VS to pre-compile them so they could be hosted by a CDN. Not sure and not concern right now. Views being pre-compiled but on a CDN may provide zero benefit.

    Anyway back to the important part. I believe there is nothing wrong with the pattern I've used for choosing which of the smart connectable sites gets redirected but I'll remove the PATH INFO condition to see if that makes a difference. I don't understand its purpose either and don't like not knowing what things do or why etc in my projects. The rest I fully get.

    Disclaimer: Boring and not particularly relevant stuff follows...

    So I'll try that now and then get back to the fun of AutoCAD not letting me create layers in either an existing drawing or new one. Every bloody time! ££££s of software constantly crashing which I can't use but need to get a rendering of the style of the device boxes ready for my meeting at 9 am, less than 7 hours away. I've been up since 5am and am going to work through the night on these things. I have to then get an ESP-12E ESP8266 Wifi board/Microcontroller hooked up to a DHT11 temperature and humidity sensor and start submitting JSON data to smartconnectables.io periodically via an as yet unwritten Web Api 2 controller, writing the data to a database and table that also don't exist yet and then a simple MVC controller to host a page that it in almost real-time pull and show the data via the client making AJAX calls - I know there are technologies out there better suited to this that are pretty much plug and play via NuGet but hell I don't have time for that tonight nor do I think it's important for my first meeting with the innovation startup business advisor I'm meeting.


    Anyway sorry for boring you. I have ADHD and have taken an extra lot of my Dexamfetamine to fuel me through the night. I'm estimating 40 cigarettes or so will be smoked too :)

    If anyone else can spot anything I'm doing wrong please go ahead and tell me... please. Pretty please!!!!

    **EDIT**

    The application starting points look fine:

    Screen Shot 2015-10-19 at 02.32.44.png

    And the domain pointers may indicate there was a problem when I changed the domain name or may not:

    Screen Shot 2015-10-19 at 02.31.18.png
    Screen Shot 2015-10-19 at 02.37.44.png

    Also I've removed all the other rules, copied yours and changed what needing changing. The only addition is the optional www pattern (www\.?). So it now looks like this:

    Code:
    <rule name="Rewrite to smartconnectables.io" stopProcessing="true">
        <match url="(.*)" />
         <conditions>
             <add input="{HTTP_HOST}" pattern="^(www\.)?smartconnectables.io$" />
          </conditions>
          <action type="Rewrite" url="smartconnectables.io/{R:1}" />
    </rule>
    
    Arrghhhhh!!!!

    So please could you check to see if anything messed up when I changed the account's domain name. I'll send an e-mail to support now with a link to this three. I'm aware that support do not offer assistance when it comes to multi-tenancy but will focus the request on checking permissions, resetting ACLs and the domain name change,
     
    Last edited: Oct 19, 2015
  9. Elshadriel

    Elshadriel Winhost Staff

    If you're going to setup the folders that way, then you need to put this in the root web.config file:

    Code:
    <rewrite>
    <rules>
    <rule name="Rewrite to leejones.website" stopProcessing="true">
    <match url="(.*)" />
    <conditions>
    <add input="{HTTP_HOST}" pattern="^leejones.website$" />
    </conditions>
    <action type="Rewrite" url="leejones.website/{R:1}" />
    </rule>
    </rules>
    </rewrite>
    
    The code is taken directly from Ben Powell's blog. If you follow that pattern, then everything should work.

    DNS is not pointing to the correct IP. The name servers are at 123-reg.co.uk. You can find the IP information for your site in the Site Info section.

    No. As far as I can tell, it's setup correctly as a domain pointer under your current site (smartconnectables.io).

    Yes, that might cause a problem. I really haven't worked with CDN's much, so I don't what the effects are.
     
    Michael likes this.
  10. Thank you Rei,

    I van absolutely no idea why happened there. The IP address being used was 96.31.35.109 which is one of yours. I suspect its because I have two accounts with you (one is for my Dad's website but I manage every technical aspect of it, he just gets the billing e-maila and makes the payments. I guess it possible I used his IP actually no I've just pinged his site and its 96.31.35.113.

    leejones.website, smartconnectables.com and .co.uk are registered with Fasthosts. So leejones.website probably has he right DNS information, the other two probably have the wrong address too otherwise they've have shown an empty directory browsing page as the \.(io|com|co\.uk) pattern should definitely work. I've spent enough time writing regular expressions that those sort of patterns are child's play.

    BUT... thank you very much for pointing this out. I should have checked this myself and feel rather embarrassed for not doing so and frustrated at the amount of time wasted. This should have been up and running 20 hours or so ago and I'd have then found time to do the RESTful API and maybe got the device I'm demoing sending data :( And be sleeping right now.
     
  11. Elshadriel

    Elshadriel Winhost Staff

    leejones.website is using our name servers:

    ns1.winhost.com
    ns2.winhost.com
    ns3.winhost.com

    That's probably why it worked. But I'm glad everything is working now? And I hope you get some rest.
     
    Michael likes this.
  12. smartconnectables.com and .co.uk were using the same IP as .io, Fasthost were providing the name servers there. I'm surprised I'm using yours for leejones.website, it my normal practice to use Fasthosts. 123-Reg only came into the things because Fasthosts do not sell or support .io TLDs.

    Anyway CloudFlare have the nicest DNS features I've seen to date so eventually I'll migrate all to them.

    It's just a case of waiting for propagation now :( And there'll be no time for rest but thanks for hoping I could.

    Thanks all! I'll be happy when I can get to the site, put my lower-case and remove www (and force https eventually) rule back in.

    What a complete waste of time and ALL my fault!!! I have no clue how I was pointing at 96.31.35.109. One last request, could you check to see why I may have that address as it is one of yours. But Elshadriel and Rei you are superstars right now!!!
     
  13. Elshadriel

    Elshadriel Winhost Staff

    Yes, 96.31.35.109 is one of ours, but I honestly don't know how/why it got set to that as well.
     
    Michael likes this.
  14. It is what it is. No point in stressing about it now as we can't go back and change it, Has totally screwed with the plans for today or rather yesterday but having updated all DNS records and flushed the DNS on my MacBook Air pings resolve to the correct IPs so now time on with it... after a smoke and a 5 minute break.

    96.31.35.109 will for ever remain a mystery and once again a BIG thanks. I owe you a good few beers.

    **EDIT**

    smartconnectables.io is working with the basic rule provided above.

    Hopefully in the next year or two you'll be using my products, Smartphone/tablet apps and other services the sites will provide if the meeting goes as well as I need it to. Elsadriel and Rei you'll get some of the first for free!
     
    Last edited: Oct 19, 2015
    Elshadriel likes this.
  15. As way of a quick thank you I'll use the following from my original config to explain a couple of things to share the knowledge:

    Code:
    <conditions logicalGrouping="MatchAll">
        <add input="{HTTP_HOST}" pattern="^smartconnectables\.(io|com|co\.uk)$"/>
        <add input="{PATH_INFO}" pattern="^/smartconnectables\.{C:0}($|/)" negate="true"/>
    </conditions>
    
    I'll start by admitting I do not understand the purpose of the PATH_INFO pattern I copied from somewhere this morning, it didn't have the capture reference (which as explained later is not permitted) in the PATH_INFO pattern. If would have been ^/smartconnectables($|/). When I have time I'll find that page again, and if the author doesn't explain its purpose I'll contact him and ask.

    Using PATH_INFO serves three main purposes which I'd say are pretty much related. The first would be to redirect old URLs to new ones, ugly URLs to friendier ones such as rewriting thread.aspx?thread=98373&page=2&comment=39334 to say /thread/URL Rewrites in IIS/2/39334 (this can go both ways, take a friendly URL and pass it to an existing implementation which requires the ugly query string. This helps with SEO but I'm no SEO expert.

    The other thing worth noting is that a condition capture back reference cannot be used in the pattern of another condition. Personally I think thats a weakness. There are likely to be several benefits of being able to do so.

    **EDIT**

    In this instance the use of PATH_INFO using the pattern ^/leejones/ is related to redirecting to nested domains, so a domain living inside a domain inside a domain and deeper. Something I'd never do! See the post by peter viola here.

    Right break over. the leejones.website issue remains, clicking the folder Alfred redirects you to http://leejones.website:80/leejones.website/leejones.website/Alfred/. Thats one for another time. I now get to suffer with AutoCAD again. See ya!!!
     
    Last edited: Oct 19, 2015
    Michael likes this.

Share This Page