(point on the internet dns to 68.146.35.78 with www.yourserver.com and on your internal dns-server to 192.168.1.2 with www.yourserver.com)
In that case, the place where moodle resides is (and should be) the same from the moodle server side of view (www.yourserver.com/moodle). Moodle shouldn't be aware on what IP-adress it is.
I think the configuration with a different port doesn't matter, as long as you remember to add the 8880 to the URL. Don't forget to open your firewall for incomming connections on that port.
unset($CFG); $CFG->dbtype = 'mysql'; $CFG->dbhost = 'localhost'; $CFG->dbname = 'moodle'; $CFG->dbuser = 'root'; $CFG->dbpass = ''; $CFG->dbpersist = false; $CFG->prefix = 'mdl_'; $CFG->wwwroot = 'http://127.0.0.1'; $CFG->dirroot = '/var/www/html'; $CFG->dataroot = '/var/www/moodledata'; $CFG->admin = 'admin';
What I am talking about is the wwwroot setting. if i set it to say what it is set now (127.0.0.1 or localhost) then i can't bring it up on another computer on the network or outside of the network. say the IP is 192.168.1.2 and i use a computer on 192.168.1.3 and point the web browser to 192.168.1.2. the resault is no images and the links don't go to the right place. that is what i have been talking about.
You just can't switch IP-adresses in the moodle configuration alone. Also look at httpd.conf for the configuration of the servername of your (apache) webserver. For IIS on windows it's some searching and klicking
# ServerName allows you to set a host name which is sent back to clients for
# your server if it's different than the one the program would get (i.e., use
# "www" instead of the host's real name).
#
# Note: You cannot just invent host names and hope they work. The name you
# define here must be a valid DNS name for your host. If you don't understand
# this, ask your network administrator.
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address (e.g., http://123.45.67.89/)
# anyway, and this will make redirections work in a sensible way.
#
# 127.0.0.1 is the TCP/IP local loop-back address, often named localhost. Your
# machine always knows itself by this address. If you use Apache strictly for
# local testing and development, you may use 127.0.0.1 as the server name.
#
ServerName localhost
A better approach to begin with would be to use "virtual hosting" on the port 80 of the server. You can have multiple DNS names point to the IP address, when the HTTP request comes in the HTTP server hands them off to the proper application. You can do this on many HTTP servers, certainly Apache and IIS can both do this. There is setup on these HTTP servers to make this work, all standard and well documented.
I think this might also address your public/private network issues, but there I'm a bit less sure having not tried this myself.
Hello Kyle.
I have a question from your words. Do you use 8880 in the URL, I mean, do you have to write down into the browser http://your.moodleserver.dom:8880
I want to have a Moodle installation in port 81 but without having explicitly write the port into the URL: http://my.moodleserver.dom
Does any body around here have it done?
Thank you very much.
P.D.
I have:
- RedHat 4
- Apache 2
- MySQL 4.1.12
- Moodle 1.5.3+
- Apache serves other apps in port 80 with different IPs.
Dear helper: Do you need more related information?
Thank you very much.
When you let the webserver listen on another port, eg 8080, you have to tell the browser to knock on another port in order to find the webserver.
So I don't see a way how to change that. Somehow your request should arive on port 8080 to reach the webserver. The way to do that is typing the alternate port with a : after the IP-address or dns name of the server.
eg http://yourserver.com:8080/moodle or http://111.111.111.111:8080/moodle
You can use Apache's mod_proxy and proxy-reverse your Moodle site.
Let's say you have your Moodle in an internal server 10.x.y.z, running at port 9876. You tell Moodle its $wwwroot is 'http://10.x.y.z:9876/. In your internet facing Apache, you use public address m.n.o.p, running at port 80. So you connect to 'http://m.n.o.p/' and you get your web pages.
Let's further suppose you want to publish your Moodle site with the following URL: 'http://m.n.o.p/moodle'. You have to add the following to your httpd.conf file (first, make sure you have mod_proxy and mod_rewrite loaded and enabled):
RewriteEngine OnDon't forget to restart your Apache daemon/service after the changes.
RewriteRule ^/moodle$ /moodle/ [R]
ProxyPass /moodle http://10.x.y.z:9876/
ProxyPassReverse /moodle http://10.x.y.z:9876/
Saludos. Iñaki.
Thanks
Hello Iñaki.
I tried yesterday your recommendation, but I could not get it.
Do I have to put them into <VirtualHost> directive?
I have:
Listen 81
NameVirtualHost mymoodleIPaddress:81
<VirtualHost mymoodleIPaddress:81>
ServerAdmin
ServerName my.moodleserver.com
.......
</VirtualHost>
Thank you very much. I really do not know to much about Apache and I can not understand Apache's online documentation about your Proxy and Rewrite modules.
Put it inside the VirtualHost directive for your moodleIPaddress and port 80.
Saludos. Iñaki.