Old:4.0-Mona: Multi-Servers: Difference between revisions

From The Uniform Server Wiki
Jump to navigation Jump to search
(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...)
 
mNo edit summary
Line 149: Line 149:
Replace two occurrences (lines 89 and 114) of Apache.exe with Apache_new.exe
Replace two occurrences (lines 89 and 114) of Apache.exe with Apache_new.exe


'''''[[#top | Top]]'''''
=== Step 8a) Edit redirect.html ===
Edit file: UniServer\udrive\home\admin\www\redirect.html
Replace: <nowiki>http://localhost/apanel/</nowiki>
With: <nowiki>http://</nowiki>localhost''':8080'''/apanel/
=== Step 8b) Edit index.php folder www ===
Edit file: UniServer\udrive\www\index.php
Replace: <nowiki>href="http:</nowiki>//localhost/apanel
With: <nowiki>href="http:</nowiki>//localhost''':8080'''/apanel
Replace: <nowiki>https:</nowiki>//localhost
With: <nowiki>https:</nowiki>//localhost''':444'''
=== Step 8c) Edit index.php folder ssl ===
Edit file: UniServer\udrive\ssl\index.php
Replace: <nowiki>href="http:</nowiki>//localhost/apanel
With: <nowiki>href="http:</nowiki>//localhost''':8080'''/apanel
Note: Two lines


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''


=== Step 8) Test servers ===
=== Step 9) 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.
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.


Line 160: Line 188:


== Install – Multi-Servers - Includes UniController ==
== Install – Multi-Servers - Includes UniController ==
If you have implemented all the above steps you only need to implement step 9.
If you have implemented all the above steps you only need to implement step 10.


If you only want to use UniController for controlling the servers make sure you implement the following steps first:
If you only want to use UniController for controlling the servers make sure you implement the following steps first:
Line 169: Line 197:
* Step 4] Edit config.inc.php
* Step 4] Edit config.inc.php
* Step 5) Rename Apache executable file
* Step 5) Rename Apache executable file
* Step 8) Web page absolute links


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
=== Step 9) Create a configuration file ===
=== Step 10) 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:  
UniController needs to pick-up the new Apache file name create a new text file '''unicon.ini''' with the following content:  
<pre>
<pre>
Line 182: Line 211:


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
== Install – Multi-Servers running as a service ==
== 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:
Prior to installing Uniform Server 4.0-Mona as a service perform the following on a new copy of 4.0-Mona:
Line 190: Line 220:
* Step 4) Edit config.inc.php
* Step 4) Edit config.inc.php
* Step 5) Rename Apache executable file
* Step 5) Rename Apache executable file
* Step 8) Web page absolute links


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


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


Now implement new steps Step 10 and 11:
Now implement new steps Step 11 and 12:
   
   
'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
=== Step 10) Change drive and or folder ===
=== Step 11) w2c1.pl Change drive and or folder ===
Optionally change the drive letter however the folder name must be changed.
Optionally change the drive letter however the folder name must be changed.


This example uses '''UniServer_2'''  
This example uses '''UniServer1'''  


Edit the following file:  \UniServer\udrive\plugins\Services\'''w2c1.pl'''
Edit the following file:  \UniServer\udrive\plugins\Services\'''w2c1.pl'''
Line 211: Line 242:
# $pathc="h:/myserver"; -- Would install to drive h sub-folder myserver   
# $pathc="h:/myserver"; -- Would install to drive h sub-folder myserver   


$pathc="c:/UniServer_2";
$pathc="c:/UniServer1";
</pre>
</pre>


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
=== Step 11) Change service name ===
=== Step 11a) w2c1.pl Change service names  ===
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'''.
Change Apache executable name and service names.
 
Edit the following file:  \UniServer\udrive\plugins\Services\'''w2c1.pl'''
 
Change this section (starting at line 99):
 
'''''From:'''''
<pre>
print "Installing Apache2 as service ...";
$res=`$pathc/usr/local/apache2/bin/Apache.exe -f $pathc/usr/local/apache2/conf/httpd.conf
  -d $pathc/usr/local/apache2/. -k install -n "Apache2"`;
print " done!\n";
print "Installing MySQL as service ...";
$res=`$pathc/usr/local/mysql/bin/mysqld-opt.exe  --install MySQL --defaults-file=$pathc/usr/local/mysql/my.cnf`;
print " done!\n";
print "Starting Apache2 ...";
$res=`net start Apache2`;
print " done!\n";
print "starting MySQL ...";
$res=`net start MySQL`;
</pre>
</pre>
 
'''''To:'''''
<pre>
print "Installing Apache2 as service ...";
$res=`$pathc/usr/local/apache2/bin/Apache1.exe -f $pathc/usr/local/apache2/conf/httpd.conf
    -d $pathc/usr/local/apache2/. -k install -n "Apache3"`;
print " done!\n";
print "Installing MySQL as service ...";
$res=`$pathc/usr/local/mysql/bin/mysqld-opt.exe  --install MySQL3 --defaults-file=$pathc/usr/local/mysql/my.cnf`;
print " done!\n";
print "Starting Apache2 ...";
$res=`net start Apache3`;
print " done!\n";
print "starting MySQL ...";
$res=`net start MySQL3`;
</pre>
 
'''''[[#top | Top]]'''''
 
=== Step 12) Change service name ===
When running muti-servers as a service their service names must be unique in this example the new service names are '''Apache3''' and '''MySQL3'''.


Edit file: UniServer\udrive\plugins\Services\files\'''Install.bat'''
Edit file: UniServer\udrive\plugins\Services\files\'''Install.bat'''
Line 229: Line 302:
To:
To:
<pre>
<pre>
C:\UniServer\usr\local\apache2\bin\Apache.exe -k install -n "Apache_3"
C:\UniServer\usr\local\apache2\bin\Apache1.exe -k install -n "Apache3"
C:\UniServer\usr\local\mysql\bin\mysqld-opt.exe --install MySQL_3 --defaults-file=C:\UniServer\usr\local\mysql\my.cnf
C:\UniServer\usr\local\mysql\bin\mysqld-opt.exe --install MySQL3 --defaults-file=C:\UniServer\usr\local\mysql\my.cnf
net start Apache_3
net start Apache3
net start MySQL_3
net start MySQL3
</pre>
</pre>


Line 246: Line 319:
To:
To:
<pre>
<pre>
net stop MySQL_3
net stop MySQL3
net stop Apache_3
net stop Apache3
usr\local\apache2\bin\Apache.exe -k uninstall -n "Apache_3"
usr\local\apache2\bin\Apache1.exe -k uninstall -n "Apache3"
usr\local\mysql\bin\mysqld-opt.exe --remove MySQL_3
usr\local\mysql\bin\mysqld-opt.exe --remove MySQL3
</pre>
</pre>



Revision as of 20:53, 18 February 2009

 

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 8a) Edit redirect.html

Edit file: UniServer\udrive\home\admin\www\redirect.html

Replace: http://localhost/apanel/

With: http://localhost:8080/apanel/

Step 8b) Edit index.php folder www

Edit file: UniServer\udrive\www\index.php

Replace: href="http://localhost/apanel

With: href="http://localhost:8080/apanel

Replace: https://localhost

With: https://localhost:444

Step 8c) Edit index.php folder ssl

Edit file: UniServer\udrive\ssl\index.php

Replace: href="http://localhost/apanel

With: href="http://localhost:8080/apanel

Note: Two lines

Top

Step 9) 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 10.

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
  • Step 8) Web page absolute links

Top

Step 10) 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
  • Step 8) Web page absolute links

Note 1:At step 5 use the following name Apache1.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 11 and 12:

Top

Step 11) w2c1.pl Change drive and or folder

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

This example uses UniServer1

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:/UniServer1";

Top

Step 11a) w2c1.pl Change service names

Change Apache executable name and service names.

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

Change this section (starting at line 99):

From:

print "Installing Apache2 as service ...";
$res=`$pathc/usr/local/apache2/bin/Apache.exe -f $pathc/usr/local/apache2/conf/httpd.conf
   -d $pathc/usr/local/apache2/. -k install -n "Apache2"`;
print " done!\n";
print "Installing MySQL as service ...";
$res=`$pathc/usr/local/mysql/bin/mysqld-opt.exe  --install MySQL --defaults-file=$pathc/usr/local/mysql/my.cnf`;
print " done!\n";
print "Starting Apache2 ...";
$res=`net start Apache2`;
print " done!\n";
print "starting MySQL ...";
$res=`net start MySQL`;

To:

print "Installing Apache2 as service ...";
$res=`$pathc/usr/local/apache2/bin/Apache1.exe -f $pathc/usr/local/apache2/conf/httpd.conf
    -d $pathc/usr/local/apache2/. -k install -n "Apache3"`;
print " done!\n";
print "Installing MySQL as service ...";
$res=`$pathc/usr/local/mysql/bin/mysqld-opt.exe  --install MySQL3 --defaults-file=$pathc/usr/local/mysql/my.cnf`;
print " done!\n";
print "Starting Apache2 ...";
$res=`net start Apache3`;
print " done!\n";
print "starting MySQL ...";
$res=`net start MySQL3`;

Top

Step 12) Change service name

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

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\Apache1.exe -k install -n "Apache3"
C:\UniServer\usr\local\mysql\bin\mysqld-opt.exe --install MySQL3 --defaults-file=C:\UniServer\usr\local\mysql\my.cnf
net start Apache3
net start MySQL3

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 MySQL3
net stop Apache3
usr\local\apache2\bin\Apache1.exe -k uninstall -n "Apache3"
usr\local\mysql\bin\mysqld-opt.exe --remove MySQL3

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