Help - can't access my staging web site

Hello

A while back I wrote in seeking advice re: losing my access to a staging web site - Camelot kindly wrote the following, which I did but it didn't work...

"Provided you're an admin on your system the easiest way is to open /Applications/Utilities/Terminal.app and run the command:

sudo echo "11.11.111.111 www.ekekekek.com" >> /etc/hosts

exactly as written (changing the IP address if you need to). This command uses sudo to elevate your privileges. You'll be asked to authenticate by typing in your password (which won't be visible), then it'll run the 'echo' command which simply prints whatever's within the quotes and appends it to the file /etc/hosts. "

Very helpful, but it didn't give me access to my staging site...last week my mac G5 crashed and had a kernel panic - spent about 1 1/2 days on the phone with half a dozen Apple techs trying to fix - it's fixed but now for whatever reason I can't access my Staging web site through any browser, though our live site is OK from any browser.

So what can I do to again have access to the staging site? Are there more steps I should know in addition to Camelot's directions? What?

I'm not a techy at all but designer so the more specific, very much appreciated.

Thanks very much
Kent

G5, FCP 4.5, Mac OS X (10.3.9)

Posted on Dec 20, 2006 1:24 PM

Reply
8 replies

Dec 21, 2006 7:09 PM in response to Kent Beeson2

Hi--

A while back I wrote in seeking advice re: losing my
access to a staging web site - Camelot kindly wrote
the following, which I did but it didn't work...


Well, his directions should work, but you need to adjust a couple of things in the command he wrote. First, let's see what your /etc/hosts file is like on your computer. Open up the Terminal application and type this command and post the result:

<pre class="command">cat /etc/hosts</pre>The default hosts file on Tiger looks like this:

<pre class="command">##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost</pre>I imagine the default in Panther will be pretty much the same. If your staging server isn't available in DNS, you can add it to this file, so your computer can find it. But you have to know a few things:

1. The IP address of the staging server. This address has to be accessible from your Mac, too. In other words, if your staging server is behind a firewall on a local area network, and your IT people haven't forwarded traffic to it, you won't be able to access it.

2. The name of the staging server. For example, most web servers use the name " www," as in www.domain.com. But your staging server could have another name, like bob.domain.com or staging.domain.com or test.domain.com.

Once you know those two things, you need to add them to the hosts file. What Camelot posted will work, but if you're not sure what you're doing, can be somewhat confusing.

Another way to add it is to use a Terminal program to edit the file. Panther comes with a simple text editor called pico that's handy for this. Open the file with this command:

<pre class="command">sudo pico /etc/hosts</pre>You can't use the mouse to move your cursor around this file, you'll have to use the arrow keys. Go to the end of the file, in my example, it would be after the last localhost. Add the IP address and name of your staging server. If you want, you can add a comment by starting the line with a " #". Say your staging server's IP address is " 123.456.789.123" and its name is " staging.domain.com". You could add these lines:

<pre class="command"># Staging server:
123.456.789.123 staging.domain.com</pre>Make sure the IP address and server name are on the same line, separated by a space or two.

To save your file in pico, hit the "control"-"o" key combination (this is listed in the menu at the bottom of the pico screen. Then exit using "control"-"x". You should be able to reach your staging server now. If not, post back with more information on the staging server and how it's set up. You can obfuscate the IP address and host name, but more information about the general setup of the network it's on would be helpful.

charlie

Jan 2, 2007 12:17 PM in response to Charles Minow

Thanks for the info - tried it but I must be doing something wrong - 1stly I typed in your code using Terminal and got this result:

##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
[Macintosh:~] kentbees%

(BTW- how do you add screenshots to these Apple forum posts? I'll have to just write it all out for now.)

I am running Panther 10.3.9 and have no text editor called pico (did a search and nothing came up) but of course I do have TextEdit. So tried textedit but still couldn't get it to work using your code for pico...then tried Camelot's original code in Terminal - replacing his example with our correct IP and www name, but it came back saying permission denied - but it never asked me for the password...so what am I doing wrong?

Thanks
KB

Jan 2, 2007 12:28 PM in response to Charles Minow

OK so I figured out that I was supposed to go to Terminal/file/New Command to type in Camelot's code - which I did, got the password prompt, wrote it, it accepted it and came back with this: (the IP and name below, I've changed for this post only)

"12.12.121.271 www.mycertainname.com">>/etc/hosts
[Process completed]

But when I now go to type in my staging site's name in the browser, I get another web site which has the same name, still can't access this site of mine.

What to do?

Thanks
KB

Jan 2, 2007 7:17 PM in response to Kent Beeson2

Kent--

Thanks for the info - tried it but I must be doing
something wrong - 1stly I typed in your code using
Terminal and got this result:

##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
[Macintosh:~] kentbees%


That looks fine. It looks like you just cut off the couple of lines from the top that are just comments anyway (the "#" at the beginning of the line).

(BTW- how do you add screenshots to these Apple forum
posts? I'll have to just write it all out for now.)


You have to add post them on a web server somewhere, then link to them in your post. There's no way to directly put them in your post (i.e., have Apple's servers host the screenshots).

I am running Panther 10.3.9 and have no text editor
called pico (did a search and nothing came up) but of
course I do have TextEdit.


Well, you have to use pico in the Terminal, which I'm pretty sure is part of the standard install of Panther. If you type sudo pico /etc/hosts in the Terminal, you should see something very much like this:

User uploaded file

Now, this is 10.4, so it says nano in the Terminal title, and the bar at the top of the window, but pico and nano work pretty much the same.

I'll address your questions in your other post in another reply to that post in a few minutes.

charlie

Jan 2, 2007 8:00 PM in response to Kent Beeson2

OK so I figured out that I was supposed to go to
Terminal/file/New Command to type in Camelot's code -
which I did, got the password prompt, wrote it, it
accepted it and came back with this: (the IP and name
below, I've changed for this post only)

"12.12.121.271 www.mycertainname.com">>/etc/hosts
[Process completed]


Hmm. That looks a little odd to me. First off, did you include the " sudo echo" part at the beginning from Camelot's post? I'm also a little curious about the "[ process completed]" part. Usually, I come straight back to the prompt.

But when I now go to type in my staging site's name
in the browser, I get another web site which has the
same name, still can't access this site of mine.


I don't give my staging sites the same names, so I'm not sure how that would work if it had the same name as another site. For example, if I have a domain called " mydomain.com," the real web server would be " www.mydomain.com" and my staging server would be
something like " staging.mydomain.com." That way, if I want to look at the real site, I type in one address. I type in the other if I want the staging server. You can't (easily) have the same text address (www.mydomain.com) resolve to different IP addresses. That requires some special DNS tricks that are beyond the abilities of the /etc/hosts file.

At this point, re-run this Terminal command and post the results:

<pre class="command">cat /etc/hosts</pre>Also, I can't figure out how to do this from the Network Utility, but you can check and see where your Mac is getting its lookup information by using another Terminal program called lookupd. You can also use it to flush the DNS cache, in case that's what's causing it to go to the other site. To flush the cache, type this in the Terminal at the prompt:

<pre class="command">sudo lookupd -flushcache</pre>You should just get the prompt back when it's done. There's no feedback.

To check where your Mac is getting its lookups, you use lookupd in an interactive mode. First, you type:

<pre class="command">lookupd -d</pre>At the prompt in the Terminal window. Then you'll get a few lines of text and a ">" prompt. Type " hostWithName", then a space and your host's name, so it looks like this:

<pre class="command">> hostWithName: www.apple.com</pre>When you hit the enter key, it'll do the lookup and give you a few lines information:

<pre class="command">Dictionary: "DNS: host www.apple.com.akadns.net"
lookup_DNSdomain: apple.com.akadns.net
lookup_DNSserver: 208.67.222.222
lookup_DNS_time_tolive: 58
lookup_DNStimestamp: 1167796142
lookupagent: DNSAgent
lookup_infosystem: DNS
interface: 4
ip_address: 17.112.152.32
name: www.apple.com.akadns.net www.apple.com
+ Category: host
+ Time to live: 43200
+ Age: 0 (expires in 43200 seconds)
+ Negative: No
+ Cache hits: 0
+ Retain count: 4</pre>Notice how it mentions DNS servers in several places, including " DNSAgent". That meant it used the DNS server at 208.67.222.222 to find the address for www.apple.com. Now, if I try it with a staging server (hosted on my iMac in this case), see what happens:

<pre class="command">> hostWithName: test.mydomain.com
Dictionary: "FF: host test.mydomain.com"
lookupagent: FFAgent
lookupvalidation: /etc/hosts 2 1166756640
ip_address: 127.0.0.1
name: test.mydomain.com
+ Category: host
+ Time to live: 43200
+ Age: 0 (expires in 43200 seconds)
+ Negative: No
+ Cache hits: 0
+ Retain count: 3</pre>Now, see how it says it looked it up using the FFAgent (Flat File), and even says it got it from /etc/hosts? If you're seeing anything except for FFAgent, then it's not looking in /etc/hosts for the info. There are ways to change the lookup order lookupd uses, but I'm pretty certain it was already set to use the flat files before DNS way before Panther.

To quit the lookupd program, just type " quit" at the prompt.

charlie

Jan 3, 2007 2:18 PM in response to Charles Minow

Thank you very much for your time and work on this, very much appreciated - most of what you wrote I did try, and also I was finally able to pin down my very busy boss who walked me through this as well (he's a tech guy at heart - NOT me) - and he had me type in (using Terminal) things like ls -l or similar and other things, trying to get me to the root...my staging site (apparently) has the same name as an entirely different company's name to which my browser was sending me. I also used "Cocktail" to clean out all cache (all this before I received your latest replies).

After much time we got it to work. Basically we did what you wrote (though it was before I saw these replies from you) and I did find pico as you said and used it - VERY COMPLEX all this stuff...I'm going to print your notes for future ref - and I thank you very much for your time!

KB

Jan 3, 2007 6:05 PM in response to Kent Beeson2

Hi--

After much time we got it to work. Basically we did
what you wrote (though it was before I saw these
replies from you) and I did find pico as you said and
used it - VERY COMPLEX all this stuff...I'm going to
print your notes for future ref - and I thank you
very much for your time!


You're welcome. I'm glad to hear you got it figured out. Sometimes, it just really takes someone right there walking through it to make it click, so I'm glad your boss was able to help.

best,

charlie

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Help - can't access my staging web site

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.