• In Chat
  • About
  • Contact
  • Browse

    Latest Coding

    Latest Daily

    Latest Health

    Featured Story

Coding 2018

| Begin | File Bank |  Register | Reply | Search | Statistics | Manual |
Local Coding / Local /  
 

Running multiple HOME servers off one IP Address

 
Author Admin
Admin


#1 | Posted: 20 Oct 2018 22:56 | Edited by: Admin 
Believe it or not this isn't hard to set up. At this moment in time this website is running off this mac pro (same one I am using now to write this) whilst I have other domains requiring a dedicated server running off a server located upstairs in a spare room. This is achieved by vhost file manipulation.

On this mac running MAMP the vhost file is to be found in /Applications/MAMP/conf/apache/extra/. The name of the file is 'httpd-vhosts.conf'. If you only need to run the one domain off your MAMP then you wouldn't need to alter this file - or your server come to that - as your website would run off the root. By placing all your files in the root directory your website would function fine. It gets a little more complicated when you want to run multiple domains - but not by much. The vhosts file on this mac already has a default, or an example vhost setup, for you. By copying it and altering it to suit your new domain you can be up and running in no time. The example vhosts commands were this ...

The Example Vhost Setup

example vhosts

All you need to create the necessary channelling to your new domain is above. This is how I have setup the shopping sub domain currently running on this mac by copying the above and altering it where necessary ...

shopping vhosts

As you can see I now have another sub domain called shopping.brainwaving.co.uk running on this mac with the files located in /Applications/MAMP/allmyshops/computers. If I wanted to run further domains I would copy and paste the above underneath and alter the names and paths to suit.

To run a domain off another server located on your home network the code below will do the trick ...

proxy vhosts

The new domain traffic is being sent to my dedicated server located on my home network with the IP Address of 192.168.1.78. The dedicated server will then receive the traffic but will need its own vhosts file to complete the process. As I am running ubuntu server 16.04 the vhost file is located in /etc/apache2/sites-available. Again there is an example vhost file there for your consideration and to help. This time I needed to create a file - lighting.conf in my case. Inside the file I added this ...

lighting.conf

Once this had been saved it needed to be activated by this command: sudo a2ensite lighting.conf. Apache needed to be restarted to finish the process off: sudo service apache2 restart did the biz.

As you can see you can run as many servers and domains as you want off the one IP Address. Quite easy really.
Website Designer

Your Reply Click this icon to move up to the quoted message


 ?
Only registered users are allowed to post here. Please, enter your username/password details upon posting a message, or register first.

 

 
Coding Powered by Forum Software miniBB ®
Online now: Guests - 1
Members - 0
Max. ever online: 33 [10 May 2019 12:44]
Guests - 33 / Members - 0
No Of Posts

  • Latest Daily Post ...

  • Latest Health Post ...

CONTACT

Phone: +01 0775 8107 427

sport4u2018@gmail.com

WEBMASTER

email icon Mark Jones

Latest Story

RANDOM CODING

  • Copyright © 2018 MKJ Brainwaving
↑ TOP