Support: 1-800-961-4454
1-800-961-2888

Running Multiple Websites on a Cloud Server with 1 IP

24

One of the most commonly asked questions my team receives from customers and prospects is: Can I run multiple websites on a single IP? The answer is yes, you can.

For this example, I will use Apache web server. During the initial configuration of apache, you will need to manage your virtual host file, commonly referred to as vhost. For the techies out there this post will be basic, however, we get a BUNCH of questions around running multiple websites on a single server.

After configuring Apache and creating the root directories for your websites, you will access the vhost file for each domain hosted on your cloud server. This is where you let Apache know where it can find each domain’s root directory. My vhost file for this website looks like this:

It’s a relatively simple process. In our Rackspace Cloud Knowledge Base, we have an article that explains how a vhost works and a more technical post on how to actually configure virtual hosts. Please note the links are for Ubuntu, you can view a conclusive list of all operating systems here.

Now that you know its simple to host multiple domains on a single IP, you may still be wondering about additional IP’s. By default, you get 1 IP address per instance. If you need additional IP’s, justification is needed. That justification would need to be SSL requirements for unique IPs per domain. For this, you can get an additional 4 IPs per instance, for a total of 5. This total is per instance. If you need additional IPs above 5, you would need to provision additional instances.

I hope you found this information useful. If you have additional questions about Cloud Servers or any of the Rackspace Cloud products, please catch us in live chat or give us a call at 1.877.934.0409.

About the Author

This is a post written and contributed by Mike Mozey.


More
  • Jon

    You would think that if someone has a cloud server they would have half a clue about the packages they are running on it.

    What’s next, can I have multiple databases in MySql?

    • http://whitedrop.net Igal Alkon

      HA HA :-) I understand why Rackspace publish this article.
      but i would strongly advice anyone who’s running a production Cloud Server at Rackspace and don’t know about Apache, Virutal Hosts and what is does read the Apache docs.

      and think he’s probably should be more concerned about his server’s security and not his 1 IP adsress. because if you run your server with one IP, that means your public IP is also your SSH IP, and that’s a bad advice :)

      see “nano /var/log/secure” for more ref.

    • Kyle

      Jon says: >> if someone has a cloud server they would have half a clue

      Maybe someone like me is researching these things, because they don’t know the answer, and wants to learn about multiple site hosting options *before* getting a rackspace cloud. And maybe you’re just a little bit of a prick.

      Jon I sure hope you’re not one of rackspace’s help staff

      • Ashleigh Davis

        @Kyle. If you ever have any questions, Rackspace’s support team is more than happy to answer questions. They are available 24x7x365 via email, web chat or phone. Next to the search box on our homepage are three options for reaching someone here at Rackspace: http://www.rackspace.com

        • Howard

          So much for Rackspace 24/7/365 chat.

  • http://WineFolly.com Justin Hammack

    I dunno – I bet there are a lot of people who have a Cloud Server as a hobby.

    I’m a borderline hobbiest – what I’d like to see an article on is how to setup a cloud server where multiple users can maintain their own websites. I guess it’s the permissions that get me.

  • http://mozeyondown.com Mike M

    Igal, im glad you brought that up. This is a simple issue to overcome. You can disable direct root login to the server and/or change the SSH port number to a non-typical port. You can also edit your iptables accordingly. I’m sure this is not a conclusive list of alternatives, however they should work great. Thanks again for the comment.

  • Pingback: 101 Ways to Make Money Online Make Money Online By Automating Websites For Passive IncomeSecond Income Generator for your Life | Second Income Generator for your Life

  • http://www.falconwebtech.com Don Irwin

    Mike – great article – I signed on as a Windows Beta customer and couldn’t be happier! I’ve posted instructions on my blog – http://www.falconwebtech.com/post/2010/08/24/Running-Multiple-Websites-on-a-Rackspace-Windows-Cloud-Server-with-one-IP.aspx for doing the same on a Windows Cloud Server.

    • http://www.nielsbrinch.com Niels Brinch

      That’s good, but what’s not possible, is to have multiple web sites if one of them needs wild card subdomains with a single IP on Windows Server. For that, a separate IP is needed for each.

      There is some configuration workarounds that can be used to simulate this, but it’s not very neat.

      Unfortunately RackSpace does not recognize having an application that utilizes wildcard subdomains as sufficient justification to be allowed to pay for an extra ip …

      • http://www.falconwebtech.com Don Irwin

        @Niels – I have multiple subdomains running on my cloud server – create a DNS entry and use a host header. If you need multiple subdomains to the same site (not sure why) you can always add w URL rewrite rule to handle.

        • http://www.nielsbrinch.com Niels Brinch

          Hi Don,

          Thanks, but by ‘wildcard’ I mean more than ‘just’ multiple, I mean all. That is the equivalent of host header *.domain.com (which is not possible in IIS). The supported alternative for Windows is to assign an ip as the host header, without mentioning any specific domain.

          There are many services that use domains like this, in the style of username.domain.com. Mine is one of them. No more, I guess :*(

  • Rigo

    Just updated that Windows info on Don’s log

  • Ivan

    Igal, Mike… for the diehard security paranoid nothing like ssh disabled. The cloud server offers a TTY so once you got your server on production you can simply shut down sshd. Nothing as safe as that.

  • Ben

    I recently found out name based SSL hosting is possible:

    http://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI

    Problem is, Windows XP doesn’t support it, unless you use Firefox…

  • http://narekk.com/ Narek

    Hosting multiple sites on a single IP is doable, but not the best solution if you are looking to increase your SERP. It’s not going to help you with your SEO goals, and linking between sites on the same IP’s will get noticed by Google Search Engine spiders. Just a tip! :)

    • intel352

      @Narek, regarding same ip for multiple websites, that is no longer true (though it used to be true), as Google now recognizes that many sites may be on the same IP or set of IPs without being related.

  • http://blog.sllabs.com Kamilion

    I’ve written up how to do a lot of the the same thing with nginx, php5, fastcgi, rvm, ruby, and rack on my blog. Just click my name and browse my archives.

  • intel352

    @Mike, nice article, but one note though: if you are running multiple websites in Apache, and any require SSL support, you must have a single IP per SSL certificate/website.

    On the other hand, if you instead drop the bloated Apache, switch to a smarter webserver application such as Nginx (which allows you to maximize the usability of a $10-20/mo Rackspace cloud server), with Nginx you can actually run multiple websites with multiple SSL certificates off of a single IP address, with no errors.

    That helped me out greatly when I found that Rackspace Cloud Server limits you to 5 IPs per server.

  • Rojar S

    Hi All,
    We had been hosting multiple websites (more than 160 web sites) on dual ip address for the past ten years on a physical server and have migrated our entire websites to RackSpace Cloud a few months back.

    All our websites are working fine in the Cloud Environment and it is really stable :D.

    However, we are still in the research state on how to tighten the server to make it even more secure.

  • http://www.ashisoft.com duplicate files

    Thanks for the information. I was just wondering about it…

  • http://ted.pennin.gs Ted Pennings

    This is a great beginner overview.

    I have one caveat/suggestion to add: **NEVER** put a document root inside a public_html folder.

    If you’re using mod_userdir, you will implicitly share all files in a public_html folder. Any virtual-host specific configuration (egauthentication domains) will be *bypassed* if someone accesses the pages via the public_html path, eg, http://host/~demo/mozeyondown.com . In general, this is a *bad* practice as it creates two valid access paths with different configurations.

    Also, if you’re not currently using mod_userdir, you may do an apache upgrade later and find it suddenly enabled… and you might not notice. Therefore, you should assume it’s on and protect yourself.

    • http://ted.pennin.gs Ted Pennings

      One more thing: this is especially bad if you don’t have PHP/Ruby enabled by default. If you enable PHP/Ruby on your virtual host but not in your base httpd.conf, any requests to http://host/~demo/mozeyondown.com/ will *NOT* be parsed by the PHP/Ruby interpreter as mod_userdir uses the base httpd.conf configuration.

      This means your configuration files could be served plain-text, database passwords and all.

  • Ravi

    HI,
    If i have two servers , server1 and server2.
    Server1 is listening http://www.example.com but if its files on server2 how would i connect with server2.

    do i have edit etc/host or http.conf file

    Thanks

Racker Powered
©2014 Rackspace, US Inc.