Apache and IIS runing in the same server in different ports

Apache and IIS runing in the same server in different ports

by Duarte Silvestre -
Number of replies: 4

Hello,

I'm running in the same server Apache and IIS. Apache is listening at port 80 and IIS at port 81.

I want to do these because if I have a problem or a need to do some maintenance to Apache, the clients will access temporarily to the port 81.

From a client, when I access with the URL www.domain.org apache will list the query and everything runs fine.

When I access using the URL www.domain.org:81 the site home page appears without any problem, but if I click in any link (for instance, the “login” link), Moodle will redirect the query to www.domain.org and drops the tcp port from the original URL.

How to correct this?

Many thanks

Duartesss

Average of ratings: -
In reply to Duarte Silvestre

Re: Apache and IIS runing in the same server in different ports

by Ken Wilson -

Hi Duartesss

Check the value of the $CFG->wwwroot variable in the moodle directory. If both IIS and apache point to the same moodle directory for their home, then this may be the problem. Two posible solutions:

1. Create two separate directories: one for IIS and the other for apache. Make them both point to the same moodledata directory. In the IIS one, set $CFG->wwwroot = 'http://www.domain.org:81' in your moodle/config.php file.

2. In theory, you could have just one moodle directory and use Howard's masquerading script (amended as follows) in your config.php to change the $CFG->wwwroot automatically depending on the server port:

 $port = '81'; 
$server_port = $_SERVER['SERVER_PORT'];
if ($server_port==$port) {
$CFG->wwwroot = 'http://www.mydomain.org:81';
}
else {
$CFG->wwwroot = 'http://www.mydomain.org';
}
// $CFG->wwwroot = .... // comment out the origninal setting

Remember to backup your config.php before making any changes, as the code above is untested.

HTH

Ken

In reply to Ken Wilson

Re: Apache and IIS runing in the same server in different ports

by Duarte Silvestre -

Many thanks again Ken!

No doubt, you are a good man !aprovador

In reply to Ken Wilson

Re: Apache and IIS runing in the same server in different ports

by Duarte Silvestre -

Many thanks again Ken!

No doubt, you are a good man !aprovador