Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
06-27-2005, 02:05 PM
|
#1
|
Member
Registered: Jun 2003
Location: USA
Distribution: Ubuntu
Posts: 169
Rep:
|
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
|
|
|
06-27-2005, 02:23 PM
|
#2
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep: 
|
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.
|
|
|
06-27-2005, 03:23 PM
|
#3
|
Member
Registered: Jun 2003
Location: USA
Distribution: Ubuntu
Posts: 169
Original Poster
Rep:
|
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
|
|
|
06-27-2005, 03:45 PM
|
#4
|
Member
Registered: Jun 2005
Location: Dallas, TX
Distribution: Fedora 11,12, RedHat4,6, CentOS4,5, FreeBSD7,8
Posts: 70
Rep:
|
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. 
|
|
|
06-27-2005, 08:15 PM
|
#5
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep: 
|
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.
|
|
|
06-28-2005, 04:22 PM
|
#6
|
Member
Registered: Jun 2003
Location: USA
Distribution: Ubuntu
Posts: 169
Original Poster
Rep:
|
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
|
|
|
06-28-2005, 04:31 PM
|
#7
|
Member
Registered: Jun 2003
Location: USA
Distribution: Ubuntu
Posts: 169
Original Poster
Rep:
|
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
|
|
|
06-28-2005, 04:41 PM
|
#8
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep: 
|
Add a line like:
Of course, substitute correct values. 
|
|
|
06-28-2005, 04:52 PM
|
#9
|
Member
Registered: Jun 2003
Location: USA
Distribution: Ubuntu
Posts: 169
Original Poster
Rep:
|
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
|
|
|
06-28-2005, 05:08 PM
|
#10
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep: 
|
Well, I'm not quite sure how FC3 configures networking, but I think it's set up in /etc/sysconfig/networking/device/ifcfg-eth0.
|
|
|
All times are GMT -5. The time now is 02:27 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|