What is my Database server host name

What is my Database server host name

by Zoran Jeremic -
Number of replies: 5
Hi,

I have installed Moodle many times, but always for my own needs on local machine. Now I have a public static IP address and I want to make it available on Internet, but I don't have domain name. I have router and I set local address of my PC to 192.168.1.5. The problem is that I can't log in Moodle any more.It stops when checking username and password. I have tried to install it again, but the database is not recognised, I believe because the wrong Host Server name.
Can you tell me how to configure this? I have tried "localhost", "192.168.1.5". Do I have to reconfigure database or something?

Thanks
Average of ratings: -
In reply to Zoran Jeremic

Re: What is my Database server host name

by Matt Molloy -

Hi Zoran,

I understand from your posting that you have a machine that you were using to serve Moodle, but only locally. Now you want to serve it to the internet. You have a router, and a private network, and your serving machine has a private, unroutable ip address of 192.168.1.5.

OK, what you need to do now is to tell your router, if it gets a request for a page, where that request should go. In other words, there is some way of configuring your router so that it sends page requests to 192.168.1.5. In other words, there is some setting on your router that allows you to configure that machine as the default server. Then, when your router receives a page request, it sends it to that machine on your LAN, because it knows it is the default server, and has some service, like Apache, listening and waiting to answer such requests.

Next thing is you need to change your config.php file. If your installation was working ok locally, then all you need to change is the wwwroot. You don't need a domain name for this, just change it to 'http://your_new_public_static_ip_address/moodle' (assuming you have your moodle files in a moodle folder directly in the web root.

Your database configuration should stay the same (assuming it is on the serving machine), and everything should function when you call: http://your_new_ip_address/moodle

Matt

In reply to Matt Molloy

Re: What is my Database server host name

by Zoran Jeremic -
Hi Matt,

Thank you for your quick answer. You are absolutely right about how my network looks like. I have already done the things about setting port forwarding on the router. My WebServer was accessible from the Internet, but Moodle elements were spread all over the windows because the "localhost" was set in config.php. I can access my web server interface without problem from the Web.

However, I could not access Web server using my public IP address from the same machine it resides on. I don't know if it is usuall behaviour? But, it makes me impossible to see how does it look from the Internet. I have to wait monday to go to my working place to see if it is everything OK with my application.

Moreover, for my research I have extended Moodle to use two other web applications that are on the same web server and moodle keeps settings about how to access them (like http://localhost/application/). What should I put here instead of localhost? Will it be accessible if I put public IP address here? It uses each other locally, and my public IP address is not visible from my local network?
I have tried many different combinations, but only if I put localhost everywhere, everythings looks fine on my own machine, but it is not OK from the Web.

In reply to Zoran Jeremic

Re: What is my Database server host name

by Matt Molloy -

Hi Zoran,

I understand exactly the nature of your problem, but unfortunately, not how to solve it!

My own setup is very similar to yours, except I can access my installation from both the serving machine and via the internet. I am not aware of anything special I did to achieve this. When I got my new fixed ip address, I just substituted that for the private (192.x.x.x) ip address I had been using to view my site locally.

What you need is advice on masquerading. I've seen your issue crop up time and time again on these forums, and masquerading seems to be the answer.

Unfortunately, I don't understand it sufficiently well to give you a more thorough explanation, but I suspect that others (RLE, KW and MK to mention a few) could fill you in with more details. I don't have this problem with my own installation, but in work, I do have this issue - I cannot access from within work, but can from outside. If I change configuration to allow local access, then web access is lost.

I'm sure one of the others will pick up on this discussion, and in the meantime, you should check this link to the FAQ and the subsequent link to masquerading on that page.

Sorry I can't be of more help, but I just don't understand enough about masquerading to fill you in.

Matt

In reply to Matt Molloy

Re: What is my Database server host name

by Richard Enison -
ZJ & MM,

I would only add that if you (ZJ) took an existing local Moodle installation and converted it to an Internet Moodle by changing config.php, the web server configuration and the router, then you also might need to use admin/replace.php to replace all occurrences of localhost in the database with your public static IP address.

I'm not the world's expert on masquerading. I have just been passing on what I have learned from reading forum posts on the subject, as well as Moodle doc pages like the ones you (MM) mentioned.

And btw, KW prefers to be referred to as KAW.smile



RLE
In reply to Richard Enison

Re: What is my Database server host name

by Zoran Jeremic -
Hi,

Thank you for your advices. It helped me to understand the problem I have here. However, I couldn't resolve it by changing localhost to my public IP address. The solution to this problem was to install the Moodle from outside location and reference it through my public IP, but it is not available from my local network. I still don't know how to tweak this. I could not use the solution described in http://docs.moodle.org/en/masquerading for Windows 2000 with DNS server as I have only one PC with Windows XP.

As I'm using two web application from Moodle that resides on the same server, I have to reference them as http://127.0.0.1/JavaBridge.

Zoran