Issues on the public IP side.

Issues on the public IP side.

by Riccardo Finotti -
Number of replies: 7

Hello everybody,

I'm new to the forum, and if this topic has already been created I'm very sorry for the duplicate.

I'm having issues with a freshly installed server, it's a CentOS7 managed by Virtualmin:
I've used the latest Moodle 3.9.1 with MariaDB 10.5.

Issue 1- Moodle is downloading as plain text, as if it couldn't load all the javascript, CSS style sheets. (you can see it on this link)
The issue appears only on the Publi IP, while on the private network moodle is loaded perfectly with no issues.

Issue 2- It is Very slow.

A little help is very much appreciate it, thank you very much.

Average of ratings: -
In reply to Riccardo Finotti

Re: Issues on the public IP side.

by Ken Task -
Picture of Particularly helpful Moodlers

In config.php file what is $CFG->wwwroot line?

Should be a fully qualified domain name ... that exist in DNS's - both internal or external (public internet).  In other words, the FQDN can be resolved by a DNS server somewhere!

As far as PHP not working ... check your config files for apache ... strange that php works only with private IP.  By chance is there something else in play?   Like selinux or mod_security or a proxy or some content delivery thang?

Clue ...

When attempting to visit site domain/moodle/ I see at bottom of browser
Connecting to 10.58.71.72

A 10. IP address is private network only.

which could be related to FQDN.

'SoS', Ken

In reply to Ken Task

Ri: Re: Issues on the public IP side.

by Riccardo Finotti -
Hi Ken,

The $CFG->wwwroot is 'http://10.85.71.72' but if I change it I'm not able to reach the page.
10.58.71.72 is the private IP of the VM (server) in which I've installed centos7 with virtualmin and moodle.

I don't have access to the Edge that controls the NAT between private and public IP, but I know that the only port open is the 80.

I'm using php 7.3 if it is of any help, but as I told before, it is very weird because from the private network I reach the page correctly, but from the public ip I see it only in Plain text without style sheets.
coudl be because of selinux?
In reply to Riccardo Finotti

Re: Issues on the public IP side.

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

As Ken says $CFG->wwwroot is wrong in config.php. A Moodle site can have only one URL and this must be specified in $CFG->wwwroot. If you want this to be accessed using a different IP address on the private network then you'll need to configure the internal DNS to resolve the URL's domain name to the internal IP address.

The URL in $CFG->wwwroot is used to load resources like JavaScript and CSS. I think the reason it's slow is that it's currently using a reserved IP address, 10.58.71.72, so the browser is trying to load these resources from this non-existent address and the connection attempt is timing out.

Ideally configure Moodle to use HTTPS, it looks like there's already a certificate in place so $CFG->wwwroot should be 'https://mic-ebc.eu/moodle'.

In reply to Leon Stringer

Ri: Re: Issues on the public IP side.

by Riccardo Finotti -
Hi Leon,

already Tryed to change the "$CFG->wwwroot" from 'http://10.58.71.72' to 'http://mic-ebc.eu/moodle' and it didn't loaded the page, it says "this page is redirecting in the wrong way"

I've also tryed to add 'http://'.$_SERVER['HTTP_HOST']; instead but it gives, Non existing Page.
In reply to Riccardo Finotti

Re: Ri: Re: Issues on the public IP side.

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

There may be a reverse proxy involved in which case you may need to add one or both of the following settings to config.php:

  1. Add $CFG->reverseproxy = true; if the web server is behind a reverse proxy.
  2. Add $CFG->sslproxy = true; if the SSL (TLS) certificate is used on an edge device but the actual web server serving on port 80. This may only be needed if the site is HTTPS (not HTTP).
Average of ratings: Useful (1)
In reply to Riccardo Finotti

Re: Ri: Re: Issues on the public IP side.

by Ken Task -
Picture of Particularly helpful Moodlers

Your server's web space is controlled by Virtualmin ... there are some providers that set customers up with Virtualmin which includes a DNS server for the domain ... in your case mic-ebc.eu - which could be slave to where your domain is registered ... which is

;; ANSWER SECTION:
mic-ebc.eu.        900    IN    NS    ns1.register.it.
mic-ebc.eu.        900    IN    NS    ns2.register.it.

To the outside world ... where I live/access ... your domain points to 2.228.173.142 which is a fastweb IP.

Suggest you have a chat with fastweb provider.

The only way to get Moodle working as it should (10. or public IP) is to have the FQDN in wwwroot variable that resolves either 10. or public IP to the same server by name.

Since you have CentOS means you probably have ssh ... or a 'Terminal' (command shell) icon in Virtualmin/Webmin?

What does cat /etc/hosts show?

In your apache config main file ... what is setting for hostname?

/etc/httpd/conf/httpd.conf

If using virtual apaches, config files the virtual domains - sites-available and sites-enabled in /etc/httpd/

'SoS', Ken



Average of ratings: Useful (1)
In reply to Ken Task

Ri: Re: Ri: Re: Issues on the public IP side.

by Riccardo Finotti -
Hello all,
I found the issue in the NAT, as I'm using a VM in a VMWARE cloud, the Vcloud Director's Firewall was giving too much issues, so we have dicided to mount the server on a droplet in Digital Ocean, now it works... I couldn't loose more time on it as the developer was breathing on my neck.

Thank you all for the help, it helped me a lot on gaining some troubleshooting information.