Old:4.0-Mona: Multi-Servers

From The Uniform Server Wiki
Revision as of 09:18, 15 February 2009 by Ric (talk | contribs) (New page: {{Nav 4.0-Mona}} '''Install – Multi-Servers''' Running more than a single instance of Uniform Server requires changing the standard port for Apache and MySQL and changing Apache’s exe...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

 

The Uniform Server 4-Mona

Install – Multi-Servers

Running more than a single instance of Uniform Server requires changing the standard port for Apache and MySQL and changing Apache’s executable name to something unique.

I have split this section into two parts the first is a general method and does not use UniController. The second part assumes you will use only UniController to control the servers.

If you wish combine both methods this allows total control meaning you can use either the batch files or UniController.

Note: If you are using UniTray the batch files will need changing.

Top

Install - Multi-Servers - Excludes UniController

Uniform Server 4.0-Mona is very flexible it is easyily modified to run more than one instance.

Start with a new copy of 4.0-Mona

US 4.0-Mona defaults: Apache ports 80 and 443 (ssl) MySQL port 3306

The following example shows how to change these to give a server with the following values:

Apache port 8080 and 444 (ssl) - MySQL port 3308

Top

Step 1) Move server port 80 to port 8080

Edit File \udrive\usr\local\apache2\conf\httpd.conf Change three occurrences (lines 124, 285 and 981) of 80 to 8080

Original    New
Listen 80                 ------- (line 124)
ServerName localhost:80   ------- (line 285)
<VirtualHost *>
  ServerName localhost:80 ---- (line 981)
  DocumentRoot /www
</VirtualHost>

 

Listen 8080
ServerName localhost:8080
<VirtualHost *>
  ServerName localhost:8080
  DocumentRoot /www
</VirtualHost

Top

Step 2) Move server (ssl) port 443 to port 444

Edit File \udrive\usr\local\apache2\conf\ssl.conf Change three occurrences (lines 9, 30 and 31) of 443 to 444

Original    New
Listen 443                  --- (line 9)
NameVirtualHost *:443       --- (line 30)
<VirtualHost _default_:443> ----(line 31)

 

Listen 444                   
NameVirtualHost *:444       
<VirtualHost _default_:444> 

Top

Step 3) Move MySQL Port from 3306 to 3308

Edit File \udrive\usr\local\mysql\bin\my.cnf

Change two occurrences (lines 11 and 20) of 3306 to 3308

Top

Step 4] Edit config.inc.php

Edit file: \udrive\home\admin\www\phpMyAdmin\config.inc.php

Change (line 38) from:

cfg['Servers'][$i]['port']          = '';          // MySQL port - leave blank for default port

To:

cfg['Servers'][$i]['port']          = '3308';     // MySQL port - leave blank for default port

Top

Step 5) Rename Apache executable file

Rename Apache executable from:

\udrive\usr\local\apache2\bin\Apache.exe

to:

\udrive\usr\local\apache2\bin\Apache_new.exe

Note: Apache_new can be any name however it must be unique

Top

Step 6a) Edit Stop.bat

Edit file: UniServer\Stop.bat

Change:

udrive\home\admin\program\pskill.exe Apache.exe c

To:

udrive\home\admin\program\pskill.exe Apache_new.exe c

Top

Step 6b) Edit usb_server_stop.bat

Edit file: UniServer\udrive\usb_server_stop.bat

Change:

\home\admin\program\pskill.exe Apache.exe C

To:

\home\admin\program\pskill.exe Apache_new.exe C

Top

Step 7a) Edit Server_Start.bat

Edit file: UniServer\Server_Start.bat

Replace two occurrences (lines 106 and 132) of Apache.exe with Apache_new.exe

That’s it you can run this alongside the original US 4.0-Mona and any mini-servers.

Top

Step 7b) Edit usb_server_start.bat

Edit file: UniServer\udrive\usb_server_start.bat

Replace two occurrences (lines 89 and 114) of Apache.exe with Apache_new.exe


Top

Step 8) Test servers

That completes moving servers to different ports, start the servers and start original installation of 4.0-Mona both will now run alongside each other.

Note: At this stage you cannot use UniControler additional modifications are required see next section.

Top

Install – Multi-Servers - Includes UniController

If you have implemented all the above steps you only need to implement step 9.

If you only want to use UniController for controlling the servers make sure you implement the following steps first:

  • Step 1) Move server port 80 to port 8080
  • Step 2) Move server (ssl) port 443 to port 444
  • Step 3) Move MySQL Port from 3306 to 3308
  • Step 4] Edit config.inc.php
  • Step 5) Rename Apache executable file

Top

Step 9) Create a configuration file

UniController needs to pick-up the new Apache file name create a new text file unicon.ini with the following content:

[APACHE]
apache_exe=Apache_new.exe

Save this file to folder: \udrive\usr\local\apache2\bin

When UniController is run it checks for the existence of file unicon.ini and picks up the new Apache file name, if file does not exist uses default name Apache.exe.

Top

Install – Multi-Servers running as a service

Prior to installing Uniform Server 4.0-Mona as a service perform the following on a new copy of 4.0-Mona:

  • Step 1) Move server port 80 to port 8080
  • Step 2) Move server (ssl) port 443 to port 444
  • Step 3) Move MySQL Port from 3306 to 3308
  • Step 4) Edit config.inc.php
  • Step 5) Rename Apache executable file

Note 1:At step 5 use the following name Apache_3.exe for the executable.

Note 2: Ensure both the service and Apache executable names have no more that eight characters.

Now implement new steps Step 10 and 11:

Top

Step 10) Change drive and or folder

Optionally change the drive letter however the folder name must be changed.

This example uses UniServer_2

Edit the following file: \UniServer\udrive\plugins\Services\w2c1.pl

Locate the line (line 18): $pathc="c:/UniServer"; and change to suite your requirements e.g.

# Change this line to drive and folder required
# $pathc="e:";          -- Would install to drive e (top-level of disk)
# $pathc="h:/myserver"; -- Would install to drive h sub-folder myserver  

$pathc="c:/UniServer_2";

Top

Step 11) Change service name

When running muti-servers as a service their service names must be unique in this example the new service names are Apache_3 and MySQL_3.

Edit file: UniServer\udrive\plugins\Services\files\Install.bat

Change these lines:

C:\UniServer\usr\local\apache2\bin\Apache.exe -k install -n "Apache2"
C:\UniServer\usr\local\mysql\bin\mysqld-opt.exe --install MySQL --defaults-file=C:\UniServer\usr\local\mysql\my.cnf
net start Apache2
net start MySQL

To:

C:\UniServer\usr\local\apache2\bin\Apache.exe -k install -n "Apache_3"
C:\UniServer\usr\local\mysql\bin\mysqld-opt.exe --install MySQL_3 --defaults-file=C:\UniServer\usr\local\mysql\my.cnf
net start Apache_3
net start MySQL_3

Edit file: UniServer\udrive\plugins\Services\files\Uninstall.bat

Change these lines:

net stop MySQL
net stop Apache2
usr\local\apache2\bin\Apache.exe -k uninstall -n "Apache2"
usr\local\mysql\bin\mysqld-opt.exe --remove MySQL

To:

net stop MySQL_3
net stop Apache_3
usr\local\apache2\bin\Apache.exe -k uninstall -n "Apache_3"
usr\local\mysql\bin\mysqld-opt.exe --remove MySQL_3

Note 1: Ensure both the service and Apache executable names have no more that eight characters and no spaces.

Note 2: Install the new server as a service by running the batch file: \UniServer\udrive\plugins\Services\Run.bat

Top

Remember

After changing ports remember these need to be included when entering a web address.

Old    New
http://localhost   http://localhost:8080
https://localhost   https://localhost:8080

In addition when installing scripts that request a MySQL server name instead of using localhost use localhost:3308

If given the option to enter a port number do so and then use localhost for the server name. Top

Related links

Reverse Proxy Server Introduction

Mini Servers Service

Top

Summary

Although there are a number of steps to perform it is relatively easy to create multi servers using Uniform Server 4.0-Mona.

Top