Skip to main content
IT BIBLESign in

Forum / Servers / Server Software

Hosting multiple websites on one physical server

Seafoam OP
Feb 9, 2016, 4:15 AM UTC
#1

Hey guys I’m new to the server scene and I wanted to know how to host multiple websites on one physical server, I’ve browsed the web and found some conflicting tutorials so I figured I would ask somebody here, if maybe you could somehow guide me through it or a tutorial you know works? thank’s in advance!

Liam
Feb 9, 2016, 4:15 AM UTC
#3

What OS are you using? And what webserver do you plan to use?

Deleted Bot
Feb 9, 2016, 4:16 AM UTC
#4

First of all i would suggest that you host your website on a VPS (virtual machine provide by some compagnie), because for 40/100$ you can have a server up and running without messing with your router.

Are you familiar with linux? Quick step,

  1. Install a linux distro, ubuntu server maybe or it can be a graphical one like the original ubuntu
  2. Install a web server like apache2
  3. Put your website in the right folder maybe /var/www/html
Deleted Bot
Feb 9, 2016, 4:16 AM UTC
#5

everybody at the same time 😛

Seafoam OP
Feb 9, 2016, 4:16 AM UTC
#6

Right now I am running Ubuntu server 14.04 I’m pretty sure, and I’ve been playing around with a vps for a couple months and decided to buy my own server, I have a 2950 with 16gb of ram. and I already have a domain linked so that when my dynamic IP changes nothing is interrupted and I already have apache2 and a website running. I’d say I’m ‘pretty’ familiar with linux but not fluent.

Seafoam OP
Feb 9, 2016, 4:16 AM UTC · in reply to #6
#7

Also I have all my port forwarding and what not setup though my router

Liam
Feb 9, 2016, 4:16 AM UTC · in reply to #7
#8

Then the tutorial Connor linked will set you in the right path. If your really stuck and you ask nicely I might be able to help via teamviewer

Seafoam OP
Feb 9, 2016, 4:17 AM UTC
#9

So for each ‘domain1 etc. etc.’ do those need to be like actual domains that I own or could I assign each virtual host a new local IP?

Liam
Feb 9, 2016, 4:17 AM UTC
#10

You’ll want to assign them to domain, or sub domains

Seafoam OP
Feb 9, 2016, 4:17 AM UTC
#11

Alright so if I want to add 1 domain when I am listing all of my virtual hosts, do i need to list my original server and domain? or only the 1 that I am adding

EDIT: Also how do I link my domain to my new virtual host? sorry if I’m being annoying haha

Seafoam OP
Feb 9, 2016, 4:17 AM UTC
#12

So i followed this guide Connor linked, and made a virtual host for my second domain, when I tried to enable my virtual host, it replies with “ ERROR: Site tristanf.me does not exist!”

WizardTux Cool Guy
Feb 9, 2016, 4:17 AM UTC
#13

Can you paste your configuration?

Seafoam OP
Feb 9, 2016, 4:18 AM UTC
#14

I got this by typing ‘sudo nano /etc/apache2/sites-available/tristanf.me’ (my second domain)

plus a ‘< /VirtualHost >’<VirtualHost *:80> ServerAdmin [email protected] ServerName tristanf.me ServerAlias www.tristanf.me tristanf.me

    DocumentRoot /var/www/tristanf.me

    <Directory /var/www/tristanf.me/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride all
            Order allow,deny
            allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/tristanf.me-error.log
    CustomLog ${APACHE_LOG_DIR}/tristanf.me-access.log combined

Okay I don't know why but a lot of code isn't working

WizardTux Cool Guy
Feb 9, 2016, 4:18 AM UTC
#15

Whats the file name for your configuration file,

When you run

sudo a2ensite

It should be

sudo a2ensite configfilename

Seafoam OP
Feb 9, 2016, 4:18 AM UTC
#16

I use sudo a2ensite tristanf.me and I even tried sudo a2ensite /var/ww/tristanf.me

WizardTux Cool Guy
Feb 9, 2016, 4:19 AM UTC
#17

It will be more like

sudo a2ensite /etc/apache2/sites-available/tristanf.me

If you are in the sites-available directory you can do

sudo a2ensite tristanf.me

Seafoam OP
Feb 9, 2016, 4:19 AM UTC
#18

still says does not exist, do I have to link my domain first? I was wondering how to link a second domain to my server as well.

WizardTux Cool Guy
Feb 9, 2016, 4:19 AM UTC
#19

Give this a try,

sudo mv /etc/apache2/sites-available/tristanf.me /etc/apache2/sites-available/tristanf_me.conf && sudo a2ensite /etc/apache2/sites-available/tristan_me.conf

You can copy and paste it as one command

Seafoam OP
Feb 9, 2016, 4:19 AM UTC
#20

Okay so, I did that, except the last part was missing the ‘f’ in tristanf_me.conf and what I got back mv: cannot stat ‘/etc/apache2/sites-available/tristanf.me’: No such file or directory but when I looked in the /etc/apache2/sites-available/ I did find tristanf_me.conf, so did that get anywhere?

Sign in to reply.