Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

apache doesnt work

Status
Not open for further replies.

vivendi

Programmer
May 12, 2005
34
Hello, i have apache installed for some time now, and everything worked fine. Untill i accidentally unplugged the cable from my router.

I have two computers here, my local ip was 192.168.1.100 and the other had 192.168.1.101, but now its the other way around. And now apache doesn't work anymore...

I forwarded the port 80 for the local ip adres i have to, but that didn't do the trick.
I also restarted apache, but that also didn't work.

BTW, i access apache from my real ip adres, so i cant access it from outside my network.
So my question is, how do i fix this..???
 
You should be able to access your router's admin software and configure a range of ip addresses that will be used for dhcp. The rest will be used for static ip addresses. Your server needs to be in this range. When you configure you network settings on Windows, you need to set it with a static ip within the static ip range of the router. This way when the router forwards to a specific ip on your lan, the server will be there to listen. If you have the server setup to configure via dhcp, then it will change every time your reboot of the signal to the gateway is lost.

 
Im not sure if i can follow you.
I have access to the admin software of the router.
DHCP is enabled and its range is set to:
192.168.1.100 ~ 192.168.1.200

I dont know where in Windows i can configure my own ip address...
Also, this computer is the only one thats online at the moment. When i type (in CMD)
ipconfig /release
ipconfig /renew

then i automatically get the IP 192.168.1.101 assigned, shouldn't 192.168.1.100 be available right now since im the only one on the network...???
 
Depending on the router, it will reserve the lease of that address for up to 24 hours. That means, that it will try to continue assinging the same address to the same network card (MAC address) until there's a reason not to.

RythmAce is suggesting that you set the server to a static IP address outside of the router's DHCP range and set your port forwarding accordingly. In your case, you could manually assign your server to 192.168.1.50, then there would never be a conflict or change because of DHCP. In Windows, this can be found in the Properties of your Network connection, TCP/IP Properties. The sunet mask is 255.255.255.0 & the gateway is 192.168.1.1 (just as they are now).
 
Thanks for the help so far, but i still have problems with Apache.

Here's what i've done so far.
I opened the window with the TCP/IP properties, in there i had to enter the 'IP address', 'subnet mask' and 'default gateway'.
I entered the following:

IP Address: 192.168.1.50
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.1.1 <-- this is also the ip to go into the admin software of the router

I also had to enter a DNS server, the router had this:
DNS Server: 62.179.104.196 212.142.28.69

So i used the first IP as the preffered DNS server in Windows and the second one as the Alternate DNS server.

Opened the admin panel in the router and i forwarded the IP 192.168.1.50 with port 80 for Apache.
But it still doesn't work. I have access to the internet, just not my apache server.

Anything else that i need to do..???
 
If smah's suggestion gives you your website, that would bring up the next question. Are you binding to a particular ip address. For example, apache by default listens for all addresses on port 80 (Listen *:80). Is there any chance you have 'Listen 192.168.1.100:80'?



 
I tried 127.0.0.1 and it did gave me my website. Listen was also set on port 80 (Listen 80).
I've tried to change it to (Listen *:80), but i still couldn't get to my site.
Then i tried (Listen 192.168.1.50:80), apache couldnt restart after that, so i set it back to the default value.

Isn't there just a way to get my old local IP back? 192.168.1.100 ...??
I mean, a static would be better in this case, but im not sure if thats gonna work :(
 
No. You're not really asking for your old ip back. You want to go back to the days when it worked and you can't do that for reasons we already explained. You will be back here again asking the same questions when your ip changes. The only way it will not change is if you give it a static ip then set port forwarding to that ip. If you did everything we suggested and it still isn't working, it may be because you are using ip based addressing rather than name based. Do you have virtual hosts defined? If so, does the container look like this:

<VirtualHost 192.168.1.100:80>

If so change it to:

<VirtualHost *:80>

Near the bottom of httpd.conf there should be this directive:

#NameVirtualHost *:80

If there is a pond sign (#) in front of it, that means it is commented out. Remove the pound sign.

 
You could change the DHCP scope that your router assigns, then statically assign your server the old IP address. However, I doubt if this would solve the problem at this point. There might be a minor misconfiguration. Posting the relavant parts of your configuration file would probably help (remove all the comments & unrelated stuff).
 
I finally fixxed it. Heres what i've done. I changed the DHCP range in the router to 192.168.1.50 ~ 192.168.1.80.
Then i booted up both computers and let the router r-assign a new ip to them by doing a /release and /renew.
Then right after that i changed the range back to 192.168.1.100 ~ 192.168.1.200 (original values) and let the router re-assign an IP to my computer first, which gave back 192.168.1.100 again :)

I really appreciate the help i got. This wouldn't have worked with the help of you guys. Thanks alot! :)
 
It's still going to chage again some day unless you assign the server a static IP address!
 
But i cant get it to work with a static IP...
 
Of course you can. You are just misconfiguring something. We just need to find out what that is. One thing I noticed is that you are pointing to dns servers outside of your network. Since your router is already pointing to dns servers. You can use your router's ip for dns as well. So 192.168.1.1 will be both thr default gateway and dns server. This however isn't stopping apache from starting when you change the ip of the server. I'm thinking that the last time you restarted apache, you actually didn't restart it but tried to start another instance of it. This would mean that the new instance of apache (httpd) already found something else already bound to port 80 and refused to start. I come to that conclusion by the fact that apache doesn't give two hoots what ip you have it listening for or on which port for that matter. It will still start if the server is configured correctly. Since you didn't change apache's configs, only the network configs, the only thing that makes sense is that your tried to start a new instance of apache.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top