View Full Version : [ubuntu] Adding sites on Apache2
May 14th, 2008, 06:57 PM
Hello there. I have experience with IIS on Windows but have switched to Ubuntu and Apache. I have my default site running in /var/www on port 80 but I would like to add another site on a separate port number. In IIS all I used to do was 'Add Site > Port xxxx'. Can anyone help me with setting this up on Apache please.
May 14th, 2008, 08:37 PM
-add the new port you want apache to listen to by editing /etc/apache2/ports.conf
echo "Listen 8080">>/etc/apache2/ports.conf
-create a new site(vhost) configuration at /etc/apache2/sites-available/<site name>
(replace <site name> with whatever you want besides default)
something like this should work
-enable your new site
sudo a2ensite <site name>
-restart apache to listen on your new port and load your new site
sudo /etc/init.d/apache2 restart
May 14th, 2008, 08:47 PM
cdenley, thanks for the walk through. It's worked perfectly :D
May 14th, 2008, 08:49 PM
I use a program called Webmin which helps! Check it out!
May 17th, 2008, 01:32 PM
concerning your Posts, I was unable to get my vhosts up and running. I can remember that it was very easy on apache1.x. But now it's just a drag..
I've got the following:
I am running apache2 on Hardy Heron.
In my /etc/apache/apache.conf, I've got the following:
# Include generic snippets of statements
# Include the virtual host configurations:
As u see, I've disabled the vhost.conf in the sites-enabled Folder. So it can do no harm :)
Path, I have two config-files:
In these, I have the following:
I was able to activate digitalearbeit by the following:
and localhost too, without an error message.
The Problem is now, that when I type digitalearbeit OR localhost Or 127.0.0.1, I only get to the first dir>digitalearbeit!
Which tells me, that the vhosts are not working properly.
Oh and before anyone asks: my /etc/hosts is:
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
Can anybody help? I really want to work and not configure....
Thanx for ur help and regards
May 17th, 2008, 08:18 PM
The last line of /etc/apache2/apache2.conf should be
This will load all your vhost configurations from that directory. That directory should contain links to the vhost files in /etc/apache2/sites-available. The links get created when you enable a site with a2ensite.
Where did this come from?
May 18th, 2008, 12:23 PM
Where did this come from?
This comes from me. An old habit from apache 1.x.
I did as you told.
Inside /etc/apache/sites-available$ is
Your choices are: digitalearbeit localhost
Site name? digitalearbeit
This site is already enabled!
Inside the .conf of /etc/apache2/sites-available$
is the following:
Typing digitalearbeit.local into a browser, brings up:
Address Not Found!
into browser brings up:
which needs no explanation..
I think there's something wrong with this:
do I have to put my IP-Address somewhere in here, and if yes, where?
Thanx in advance
May 18th, 2008, 01:09 PM
Im not sure because I dont really understand all this all that well, but I I have not had any reall problems getting my vhosts to work,
I think you need to add digitalearbeit to your hosts file.
something like this I think
127.0.0.1 localhost digitalearbeit
Hopefully someone that knows better will point Out my error if Im wrong.
May 18th, 2008, 03:54 PM
Any hostname you look up in a browser has to resolve to an IP address. If you want digitalearbeit.local to resolve to 127.0.0.1, you need this line in /etc/hosts
There is nothing wrong with this unless you want the server to listen on a specific interface. An asterisk means you can connect through any interface.
May 18th, 2008, 06:36 PM
U two were absolutely right...
Everything works now.. Thanx
April 25th, 2013, 04:24 PM
I am very new to apache2 and LAMP environments in general. I have set up an EC2 instance with aws and installed apache2. I pointed a domain name at my elastic ip address and setup phpmyadmin, mysql and joomla and it all seems to work fine. I am not trying to add another domain name. So I have pointed the second domain name at my elastic ip address and am now trying to configure the vhosts in apache2. So I added a site to /etc/apache2/sites-available and i edited the file to so it says ServerName (my website) instead of ServerAdmin webmaster@localhost and also changed the DocumentRoot, I did this same process with "default" and changed default to my other domain name. I also went into the /etc/hosts file and added the two websites to the local ip addresses. I enabled both websites and it says both are enabled. The problem is when i try to restart apache2 it says "Syntax Error on line 262 Invalid Command '=====================' maybe and misspelled word or command. Ive gone back in using the command vi /etc/apache2/apache2.conf and tried several different things but nothing seems to work. Any suggestions?
Thank you in advance for any help
April 27th, 2013, 03:04 PM
If a post is older than a year or so and hasn't had a new reply in that time, instead of replying to it, create a new thread. In the software world, a lot can change in a very short time, and doing things this way makes it more likely that you will find the best information. You may link to the original discussion in the new thread if you think it may be helpful.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.