Dear Team,
I am currently running moodle in my campus. there is a local ip address and a public ip address. I am unable to figure out a way to have a single ip address to access moodle both on campus and off campus. current the moodle can operate on either on campus or off campus. It is running on Apache+mysql.
Generally you would fix that with DNS by having your local DNS resolve the name to an internal address while external DNS resolves it to the external address.
Assuming there is some reason you can't do that, you could create a reverse proxy in Apache to map your internal site to an external name or IP address. I do this with Monitorix on a few VM's:
ProxyPass /monitorix http://127.0.0.1:8080/monitorix
ProxyPassReverse /monitorix http://127.0.0.1:8080/monitorix
ProxyPass /monitorix-cgi http://127.0.0.1:8080/monitorix-cgi
ProxyPassReverse /monitorix-cgi http://127.0.0.1:8080/monitorix-cgi
In your case, you'd have a second website that uses ProxyPass / to map to the on-site Moodle address. You'd probably only need 2 lines to do it since you're mapping the whole site.
Assuming there is some reason you can't do that, you could create a reverse proxy in Apache to map your internal site to an external name or IP address. I do this with Monitorix on a few VM's:
ProxyPass /monitorix http://127.0.0.1:8080/monitorix
ProxyPassReverse /monitorix http://127.0.0.1:8080/monitorix
ProxyPass /monitorix-cgi http://127.0.0.1:8080/monitorix-cgi
ProxyPassReverse /monitorix-cgi http://127.0.0.1:8080/monitorix-cgi
In your case, you'd have a second website that uses ProxyPass / to map to the on-site Moodle address. You'd probably only need 2 lines to do it since you're mapping the whole site.
The documentation of the first method Bret mentioned: Masquerading.