Avatar of adding7
adding7
 asked on

Apache on Ubuntu

I have inherited an Ubuntu 12.4 server that is hosting a number of web sites.  The nameserver that was running the DNS management has been shut down and I need to access the web sites so we can copy them to another location.

I can access the command line on the Ubuntu server and can see the .conf files for the sites but cannot access them.  

If I navigate to the ip address of the server I can see one of the web sites but can't access the others.

Is there some way I can find a url so I can access these.
Web ApplicationsWeb Servers

Avatar of undefined
Last Comment
adding7

8/22/2022 - Mon
junipllc

Yes, what kind of computer do you have? You can put the IP address and hostname into your "hosts" file to trick the local machine into sending all of your requests to the IP address with the proper Host: header.

For example, on the Mac you would edit your /etc/hosts file and add:

12.34.56.78   domain.com
12.34.56.78   domain2.com
etc.

where '12.34.56.78' is the IP address and you're basically overriding the actual DNS.

I typically don't like to just put a link up for an answer, but this has all you need in order to accomplish that:

http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file

Cheers,

Mike
Gary

Is this through SSH?
Are you logged in as an admin user? Can you use sudo to open to the file
sudo vi file.conf
gurutc

Also, the IP addresses for the specific websites should be in the conf files for the virtual hosts.  

- gurutc
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
adding7

ASKER
Mike,

That's really smart - so I'm not sure why its not working......  I've tried the domain with and without the 'www' in the hosts file.  I've flushed the DNS and can confirm that a 'ping' returns the IP address that I've put in the host file.

When I open a browser, it returns to 'names.co.uk which is where the domain is now hosted!

Sorry, but any ideas?
gurutc

It looks like the sites were sharing the same IP address and were being distinguished by the host header.  So you also need to add host records to your hosts file like so:


12.34.56.78   domain.com
12.34.56.78   domain2.com

12.34.56.78   www.domain.com
12.34.56.78   www.domain2.com

Good Luck,
gurutc
Gary

Is this question how to move files or how to setup virtual domains.
What is the point of modifying your own hosts file? If the DNS is not working then your domain/s in essence do not exist and you can only access the default domain on the server via the IP of the server (which you have found out to be names.co.uk).
So forget all this rubbish about modifying your hosts file.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Gary

It sounds like you need to set up new nameservers somewhere else, who is responsible for your domain registration?  Is the same company that was hosting your nameservers?
gurutc

sorry, I see you've done the hosts thing.

Are you sure your server was only listening on one address?

You can also make your server believe the domains exist by editing the server's host file as well.  That will make them 'exist'

You could try this to make sure the server is listening on only one IP:

netstat  -tanpu | grep ":80 "

- gurutc
Gary

Hello!
The nameserver that was running the DNS management has been shut down

As far as the world is concerned the domains no longer exist!
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
junipllc

cathal said:

So forget all this rubbish about modifying your hosts file.

I'm sorry, but you are incorrect. Apache will respond to the Host: header regardless of whether the DNS exists publicly. This is the oldest trick in the Web developer's book.

Cheers,

Mike
ASKER CERTIFIED SOLUTION
junipllc

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Gary

Who cares if you can send an header and get to the website through a browser.  What has that got to do with his DNS problems or getting access to the server
junipllc

@cathal,

That's what he's trying to do. Re-read his question. He said "and I need to access the web sites." and "If I navigate to the ip address of the server I can see one of the web sites but can't access the others." That leads me to believe that he wants access to the sites via a browser. He already has SSH access. Perhaps I am wrong, but that is how I read the question.

The /etc/hosts file will allow him to circumvent DNS altogether. No DNS lookups are ever made, so the fact that there is no public DNS for the sites is irrelevant.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
adding7

ASKER
Mike,

I can confirm that you did understand the question absolutely correctly, I am trying to get to a web site that is on the old server so I can copy it to a new location.

Although I haven't managed to do this I suspect - as you suggest - there is a problem with the apache.....

Anyway, your advice was sensible and clear so I have awarded the points accordingly - many thanks.