Many routers do not let your see your own site. In other words, you are using DDNS to link your current IP address to a certain domain name. When you request it, the request comes from inside your intranet (behind your router), out into the world, to your DDNS service (2mydns, etc.) and then back to the same router to be sent to your machine through a virtual server or IP forwarding setup. Some routers don't let you do loop back like this. Mine doesn't.
However, I thought that putting my intranet (local) IP as the IP for my domain name in my /etc/hosts file (can do the same with the hosts file in Windows) would get around this problem. I still cannot install moodle.
Anyone know better?
I have moodle running in my PC that acts as router and firewall.
The IP of router/firewall is 192.168.0.2. Mandrake 10, shorewal as firewall and DynDNS as dinamic hosting IP provider.
You need to configure the shorewall to perform DNAT from net to router loc:local IP number.
DNAT net loc:your local IP (ex 192.168.0.1) tcp http,https
In case your PC is the firewall itself change loc: for fw: (not documented but costed me two month of probings)
I hope it help you
For the reference of others reading this, when you use a router for a home server and you are using NAT (network address translation or masquerading), you have to get the router to send incoming port 80 http requests to the machine you are using as a server. This function in the router is called IP Forwarding usually, but my corega (Japanese) calls it Virtual Server. Anyway, you set up a static IP address for the server in your DHCP, meaning that you tell the router to give random, automatic IP addresses to all other machines but to always give a certain IP address to the server. Then you set virtual server to send all incoming port 80 http traffic to that server's IP address.
My setup works as is. I can see the index for other directories from work, no problems. The problem occurs after I enter my database info on install.php. This happens regardless of whether I am accessing from within my home network or from work. The install goes fine until the program has to create the config.php file from config-dist.php. The config.php file is not created, and from that moment on, I get a blank screen when I go to the Moodle top or when I go to http://moodlepath/admin/. Nothing works anymore.
If I then erase it all and re-cvs it back in, the same thing happens all over again: Moodle's install.php shows and asks me for language, then I enter some variables, then the database info, and then blank page. No error messages in /var/log/, no error messages on screen.
Do you think it is the way I set up my hostname or something?
Or is there some setting in php that would make it stop right at that point? I think this sounds most plausible.
If we can figure this out, I will make an easy-to-understand recipe for this problem.
What is your "dbhost" database server address? Assuming MySQL is on the same box as the rest of your AMP installation, it should be "localhost" not the internal or external address of your server.
Also, the Moodle "wwwroot" should be the external address of your router. If it's a registered dns entry (I use the service at http://www.dyndns.org), you should also configure the HOSTS files on all your systems on your internal network with the "wwwroot" address and the internal IP address of your server.
My setup: Broadband cable with Dlink router with "virtual server" features and the Moodle server with a static IP address on the internal network.
Hope this helps...
I ve got :
- myname.dyndns.org external URL
- Server's IP 192.168.0.53
- wwwroot: /opt/lampp/htdocs
In a Windows systems usually under C:\windows\system32\drivers\etc, the "hosts" file should have an entry:
Note that this is only for those systems on your internal network so they can find your Moodle server. On my home office network, I have two Windows systems, one Windows server with Moodle and one Linux server with Moodle inside the router. The two Windows systems have an entry in their "hosts" files to find the Moodle servers.
Hope this helps...
For others reading this, when we talk about a database server, we are talking about a machine that is running the database server SOFTWARE. You can have one machine that acts as several servers, in that sense, if it is running several server programs. With Moodle, if the database server software (postgresql or mysql) is running on the same machine as the web server (httpd, apache), then the web server and moodle look to the same machine (localhost) for the database server. If your database server is in a separate machine, you put that separate machine's hostname here.
Thank you for the tip on Moodle's wwwroot, I had it right, but it was a guess. I was unsure if the DDNS would resolve correctly. I also already had the DDNS-registered host name in my /etc/hosts file, so I knew that it would work within my computer, but I was unsure if it would work through the router.
Partial recipe on DDNS behind a router home server and Moodle:
- In a terminal, type 'ifconfig' to find your MAC address, which is also called the hardware address or id. This is the unique ID of your network card. If you replace the network card, this will change. Each network or LAN card sold has a MAC that is unique in all the world (or should be).
- In your router's DHCP settings, leave DHCP on but find the option that offers a static IP for certain machines. This tells the router to give the same IP (any local IP is okay, so use 192.168.1.10) to the MAC address you discovered above. This means that the router will give any machine an IP address, but when it sees your server's MAC, it will give it 192.168.1.10. Think of it as reserving an IP address for your special machine so that the IP address is the same every time you boot.
- Next, you want to tell the router to pass incoming web requests straight to your server. The reason routers are so nice is that not only can you get many internet connections from the same ISP, but also machines on the internet cannot see the PC's you are using. From the outside, no one can tell how many machines are behind that router, what the addresses are, etc. It is a mask, which is why this NAT (network address translation) used to be called masquerade, from the masking of the internal machine's addresses. So you basically use "Virtual Server" or "IP Forwarding" to tell the router to send all incoming TCP requests on port 80 (or whatever port you are using in your web server) to the IP address 192.168.1.10. Because you reserved that IP address for your server, the requests will always go to it.
- Now, if your machine is set up to receive http requests, it should work, assuming that your DDNS registration is done correctly.
- Some routers (like mine) don't let you loop back to your machine from the DDNS server. So you could have everything set up nice and correctly, but when you enter http://mynewddnsdomain.2mydnsprovider.net or whatever domain you recieved, you get a "Connection refused" error. You have to add that IP address and domain to your hosts file (/etc/hosts) in order to configure your machine. Your machine checks the hosts file first, so once you add an IP and domain to /etc/hosts, your machine does not check the internet at all. It goes to that IP for that domain. By setting hosts in your server and other machines on your local intranet (behind that evil router that does not allow loop-backs), you make sure that everybody knows that 192.168.1.10 is the address you mean when you say mydomain.com.
- Then you need to make sure that the machine is visible to others on the net:
- If you have telnet or ssh access to a machine outside of your network (on a different ISP or even through mobile access), you can use "curl http://domain.com" to get that machine to access your page and show you the html it gets back.
- Call a friend to access for you.
- Go to: "http://www.submitshop.com/tools/linkchecker.html" or some similar free webmaster tool page that will hit a URL for you and check to make sure that it is there. You should see the names of your files.
It seems you have the same problem like me. I stuck in the installation, nothing in error messages of Apache. It is related to Moodle in my cases. I suspect on cr /LF windows caracters in the php scripts (you can see them in a linux text editor, they do not appear in other softwares i installed allready). I could install it in Mandrake 10 (it appeared in one case the same problem) , but not in FreeBSD.
Could you install other software in the same way?
Wich is you server ?
Hope will help you find the solution.