LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-27-2005, 02:05 PM   #1
Rundi
Member
 
Registered: Jun 2003
Location: USA
Distribution: Ubuntu
Posts: 169

Rep: Reputation: 30
Fake Web Address on Local Server


Hello all -

I am a Linux server newbie. I set up Fedora Core 3 on an old box. I've managed to get http (apache), ftp, and remote ssh to work. My goal for this box is for it to be my local test location (on my LAN) for building webpages that I can later upload to the internet.

My question is this: Suppose I want to build a website at http://mywebsite.com. I have one page at http://mywebsite.com/page1.html and another page at http://mywebsite.com/page2.html. If I have a link on the first page pointing to the second page (and it is not a relative link) the link won't work on my local server. Is there any way I can "spoof" (not sure that is the right term) my domain name on my local server so that when I am on my local server and click a link for http://mywebsite.com/page2.html it will actually go to my local page?

I hope I have made that question clear enough. I am a new to this server stuff so I don't know if this is completely impossible, very hard, or easy.

Any help would be much appreciated.

Thank you.


Rundi
 
Old 06-27-2005, 02:23 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Set up your own DNS server if you want to do it for a whole LAN. If you're just doing development from one workstation, just add the domain to /etc/hosts with the server's IP. Don't forget to remove it when you move to the real server or you will have no end of headaches.
 
Old 06-27-2005, 03:23 PM   #3
Rundi
Member
 
Registered: Jun 2003
Location: USA
Distribution: Ubuntu
Posts: 169

Original Poster
Rep: Reputation: 30
OK

Quote:
Don't forget to remove it when you move to the real server or you will have no end of headaches.
How so? I thought anything in /etc/hosts wouldn't effect the actual pages of the website.

Also, how hard is setting up the DNS? About the same as setting up apache and ftp or harder?

Thanks.

Rundi
 
Old 06-27-2005, 03:45 PM   #4
Sharaz
Member
 
Registered: Jun 2005
Location: Dallas, TX
Distribution: Fedora 11,12, RedHat4,6, CentOS4,5, FreeBSD7,8
Posts: 70

Rep: Reputation: 16
i would recommend the host file, if its just for one record; this will by far be the simplest way. setting up an entire bind, while a good learning excercise, is like using a 12 guage to kill al cockroach.
 
Old 06-27-2005, 08:15 PM   #5
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
You could use something more lightweight than bind (dnsmasq comes to mind), but if you are only working with one workstation, then the hosts solution is a hundred times easier.
Quote:
How so? I thought anything in /etc/hosts wouldn't effect the actual pages of the website.
It won't affect the website, but it will affect what your client thinks is the website: you'll still see the local server, so if you have problems on the production server, you might not notice.
 
Old 06-28-2005, 04:22 PM   #6
Rundi
Member
 
Registered: Jun 2003
Location: USA
Distribution: Ubuntu
Posts: 169

Original Poster
Rep: Reputation: 30
Thanks

Quote:
You could use something more lightweight than bind (dnsmasq comes to mind), but if you are only working with one workstation, then the hosts solution is a hundred times easier.
Ok, then it looks like the host solution is what I want to do. I will try to go and do that and if I run into any difficulties I'll come back.

Thanks to both of you for the responses.


Rundi
 
Old 06-28-2005, 04:31 PM   #7
Rundi
Member
 
Registered: Jun 2003
Location: USA
Distribution: Ubuntu
Posts: 169

Original Poster
Rep: Reputation: 30
Oops

One more question. When you say

Quote:
If you're just doing development from one workstation, just add the domain to /etc/hosts with the server's IP
do you mean adding "mywebsite.com" to the line for 127.0.0.1 or adding "mywebsite" to a new line which would contain 192.168.1.1 (or whatever my local LAN ip for the machine was)?

Thanks.

Rundi
 
Old 06-28-2005, 04:41 PM   #8
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Add a line like:
Code:
192.168.1.1 mywebsite.com www.mywebsite.com
Of course, substitute correct values.
 
Old 06-28-2005, 04:52 PM   #9
Rundi
Member
 
Registered: Jun 2003
Location: USA
Distribution: Ubuntu
Posts: 169

Original Poster
Rep: Reputation: 30
Hoookay

That's what I kind of thought. But that brings up a slightly different question.

I have my server where the website is located for construction. And, I have this computer I am writing on, and where I will access that local copy of the website from the server to work on it.

Both of these computers are assigned IPs by my Linksys router. However, they are currently being handed out dynamic IPs. Thus, every time the IP of my server changed I would have to go into etc/hosts/ and change that line of the file you just explained to me.

Of course, I could do that. But it would be easier if I could assign a static IP to my server so I only had to set the file once. I know it can be done because I have done it with a Win XP system on the Linksys router. But I don't have a GUI on my server and I have no idea how to give the server a static IP.

Any chance you could explain that to me, or will I have to edit my etc/hosts file once a day?

Maybe it would just be easier to set static IP for the entire LAN at the Linksys end of things. I know how to do that.

Rundi
 
Old 06-28-2005, 05:08 PM   #10
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Well, I'm not quite sure how FC3 configures networking, but I think it's set up in /etc/sysconfig/networking/device/ifcfg-eth0.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cant make web server run my local web page... Nik0s Linux - Newbie 22 10-08-2006 10:30 PM
Local webserver -- How to deny all client install their local web server--Please help b:z Linux - Networking 13 04-16-2005 07:11 PM
difference between "Web server local URL" and "IPv4 address"? kpachopoulos Linux - General 2 09-17-2004 01:30 PM
Apache2 Server - not working outside local ip address range Robstro Linux - Networking 3 06-14-2004 05:32 PM
Local Web Server amdawi Linux - Networking 15 09-30-2003 04:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration