Link to home
Start Free TrialLog in
Avatar of nachtmsk
nachtmskFlag for United States of America

asked on

Apache - Ubuntu - Virtual hosts

hi,
I have Virtual hosts set up on Ubuntu/Apache.
The domain names for my sites are working fine.
But if I type in the IP address of my server I get the apache default page.
What do I need to put in the apache conf file to direct the IP address of the server to display a site on my server.
Do I need to create a whole new <VirtualHost *.80>  block or do I enter something in the current <VirtualHost *.80> block?
Thanks!
Nacht
Avatar of BeckSCS
BeckSCS

Your conf file should have something like this for the configuration.

<VirtualHost ipAddress:80>
ServerName domain.com
ServerAlias www.domain.com
ServerAdmin name@domain.com
DocumentRoot /var/www/"file location"
</VirtualHost>

The main important part is the ipAddress and DocumentRoot. If you would like a tool to better help you manage the server webmin is free and works great on ubuntu.

If you plan on running multiple websites from the same server you'll need to look into setting up a MultiSite Layout.
Avatar of nachtmsk

ASKER

Thanks, but where/how do I put in the IP address of the server so it directs to a virtual site and not the default Apache site?
It sounds like the issue that you're running into is the document location is wrong. Find where you are saving the web files and add that document location.

Changing the <Directory /var/www/> to your location should work if you're only running one website on the server.

You will have to restart apache or the server when making changes.

sudo service apache2 restart or sudo /etc/init.d/apache2 restart

What kind of access do you have to the server?
I have root access. Think I just solved it. I put in a server alias of the IP address. The problem I was trying to solve is that the IP address was going to the default location while the virtual  hosts (domain names) were going to the correct location. I wanted the IP address (if put into a browswer) to go to one of my virtual hosts.
ASKER CERTIFIED SOLUTION
Avatar of nam0a
nam0a
Flag of Nepal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial