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!
This should get you started.
What OS are you using? And what webserver do you plan to use?
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,
- Install a linux distro, ubuntu server maybe or it can be a graphical one like the original ubuntu
- Install a web server like apache2
- Put your website in the right folder maybe /var/www/html
everybody at the same time
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.
Also I have all my port forwarding and what not setup though my router
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
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?
You’ll want to assign them to domain, or sub domains
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
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!”
Can you paste your configuration?
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
Whats the file name for your configuration file,
When you run
sudo a2ensite
It should be
sudo a2ensite configfilename
I use
sudo a2ensite tristanf.me
and I even tried
sudo a2ensite /var/ww/tristanf.me
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
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.
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
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?