1,478
edits
(New page: {{Uc nav mini servers}} Apache 2.2.9|right'''Mini server 3 running as a service''' This page covers running our mini server (describe on the [[Mini Servers: Apach...) |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{Uc nav mini servers}} | {{Uc nav mini servers}} | ||
[[Image:Uc_mini_3a.gif|Apache 2.2.9|right]]'''Mini | [[Image:Uc_mini_3a.gif|Apache 2.2.9 Perl 5.10|right]]'''Mini Server 10 running as a service''' | ||
This page covers running our mini server (describe on the [[Mini Servers: Apache 2.2.9 Perl 5.10 Portable|previous page]]) as a service, its big brother Uniform Server 3.5-Appolo automates this process. We are not going to take this easy option! Well you would never learn anything by doing that, the manual alternative although slightly more difficult provides an insight into Apache and Uniform Servers flexibility. | This page covers running our mini server (describe on the [[Mini Servers: Apache 2.2.9 Perl 5.10 Portable|previous page]]) as a service, its big brother Uniform Server 3.5-Appolo automates this process. We are not going to take this easy option! Well you would never learn anything by doing that, the manual alternative although slightly more difficult provides an insight into Apache and Uniform Servers flexibility. | ||
Line 34: | Line 34: | ||
=== Absolute === | === Absolute === | ||
Windows likes pegs hammered into the ground so to speak, hence when running as a service specifying absolute paths is essential to keep both parties happy for example '''c:\ | Windows likes pegs hammered into the ground so to speak, hence when running as a service specifying absolute paths is essential to keep both parties happy for example '''c:\mini_server_10''', the drive must be specified and then any folders etc. | ||
No need to ramble on, just remember absolute paths are the order of the day so lets roll up ours sleeves and look at some code hacking. | No need to ramble on, just remember absolute paths are the order of the day so lets roll up ours sleeves and look at some code hacking. | ||
Line 41: | Line 41: | ||
== Configuring Apache == | == Configuring Apache == | ||
As mentioned above absolute paths are required in the configuration file. I have chosen to run the server on '''C''' drive from folder ''' | As mentioned above absolute paths are required in the configuration file. I have chosen to run the server on '''C''' drive from folder '''mini_server_10''' you can use a different drive and or folder the choice is yours, just substitute accordingly. I have highlighted these absolute paths in bold interestingly these are the only changes required to our original configuration file. | ||
Note: I have moved the server to port 8090 prevents clashing with other servers. | |||
{|border="0" cellpadding="4" cellspacing="1" style="background:#222222" | {|border="0" cellpadding="4" cellspacing="1" style="background:#222222" | ||
|-style="background:#e8e8e8" | |-style="background:#e8e8e8" | ||
!httpd.conf located in folder: C:\ | !httpd.conf located in folder: C:\mini_server_10\usr\local\apache2\conf | ||
|-style="background:#f5f5f5" | |-style="background:#f5f5f5" | ||
| | | | ||
<nowiki>#</nowiki> | <nowiki>#</nowiki> File name: http.conf<br> | ||
<nowiki>#</nowiki> | <nowiki>#</nowiki> Created By: The Uniform Server Development Team<br> | ||
<nowiki>#</nowiki> Edited Last By: Mike Gleaves (ric) <br> | |||
<nowiki>#</nowiki> Main Apache 2.2.9 HTTP server configuration file.<br> | <nowiki>#</nowiki> Main Apache 2.2.9 HTTP server configuration file.<br> | ||
<nowiki>#</nowiki> | <nowiki>#</nowiki> Supports Perl<br> | ||
<nowiki>#</nowiki> V 1.0 14-7-2008 | |||
|-style="background:#f5f5f5" | |-style="background:#f5f5f5" | ||
| | | | ||
Line 69: | Line 72: | ||
<nowiki>#</nowiki> Basic settings <br> | <nowiki>#</nowiki> Basic settings <br> | ||
<nowiki>#</nowiki> ======================================== <br> | <nowiki>#</nowiki> ======================================== <br> | ||
Listen | '''Listen 8090''' <br> | ||
ServerName localhost: | '''ServerName localhost:8090'''<br> | ||
ServerAdmin fred@www.somedomain.com <br> | ServerAdmin fred@www.somedomain.com <br> | ||
UseCanonicalName Off <br> | UseCanonicalName Off <br> | ||
Line 109: | Line 112: | ||
</Directory> | </Directory> | ||
'''<Directory "c:/ | '''<Directory "c:/mini_server_10/www">''' <br> | ||
Options Indexes FollowSymLinks Includes ExecCGI<br> | Options Indexes FollowSymLinks Includes ExecCGI<br> | ||
Order allow,deny <br> | Order allow,deny <br> | ||
Line 119: | Line 122: | ||
<nowiki>#</nowiki> Access control cgi <br> | <nowiki>#</nowiki> Access control cgi <br> | ||
<nowiki>#</nowiki> ======================================== <br> | <nowiki>#</nowiki> ======================================== <br> | ||
'''ScriptAlias /cgi-bin/ "c:/ | '''ScriptAlias /cgi-bin/ "c:/mini_server_10/cgi-bin/"''' | ||
'''<Directory "c:/ | '''<Directory "c:/mini_server_10/cgi-bin">''' <br> | ||
AllowOverride None<br> | AllowOverride None<br> | ||
Options None<br> | Options None<br> | ||
Line 133: | Line 136: | ||
<nowiki>#</nowiki> ======================================== <br> | <nowiki>#</nowiki> ======================================== <br> | ||
DefaultType text/plain <br> | DefaultType text/plain <br> | ||
'''TypesConfig c:/ | '''TypesConfig c:/mini_server_10/usr/local/apache2/conf/mime.types''' | ||
|-style="background:#f5f5f5" | |-style="background:#f5f5f5" | ||
| | | | ||
Line 152: | Line 155: | ||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
== | == install.bat == | ||
Batch files to install and uninstall Apache as a service are not very complex; the trick is to supply all the right parameters as shown. | Batch files to install and uninstall Apache as a service are not very complex; the trick is to supply all the right parameters as shown. | ||
Line 159: | Line 162: | ||
{|border="0" cellpadding="4" cellspacing="1" style="background:#222222" | {|border="0" cellpadding="4" cellspacing="1" style="background:#222222" | ||
|-style="background:#e8e8e8" | |-style="background:#e8e8e8" | ||
! | !install.bat located in folder: C:\mini_server_10 | ||
|-style="background:#f5f5f5" | |-style="background:#f5f5f5" | ||
| | | | ||
<pre style="border:none;padding:0;margin:0"> | <pre style="border:none;padding:0;margin:0"> | ||
echo. | echo. | ||
c:\ | c:\mini_server_10\usr\local\apache2\bin\Apache.exe -k install -n "mini_server_10" | ||
echo. | echo. | ||
net start | net start mini_server_10 | ||
echo. | echo. | ||
echo Type http://localhost into your browser to access server. | echo Type http://localhost:8090 into your browser to access server. | ||
echo. | echo. | ||
pause | pause | ||
Line 177: | Line 179: | ||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
== | == uninstall.bat == | ||
The uninstall batch file first stops the | The uninstall batch file first stops the “mini_server_10” service and then proceeds to uninstall it. | ||
{|border="0" cellpadding="4" cellspacing="1" style="background:#222222" | {|border="0" cellpadding="4" cellspacing="1" style="background:#222222" | ||
|-style="background:#e8e8e8" | |-style="background:#e8e8e8" | ||
! | !uninstall.bat located in folder: C:\mini_server_10 | ||
|-style="background:#f5f5f5" | |-style="background:#f5f5f5" | ||
| | | | ||
<pre style="border:none;padding:0;margin:0"> | <pre style="border:none;padding:0;margin:0"> | ||
echo. | echo. | ||
net stop | net stop mini_server_10 | ||
echo. | echo. | ||
c:\ | c:\mini_server_10\usr\local\apache2\bin\Apache.exe -k uninstall -n "mini_server_10" | ||
echo. | echo. | ||
echo Done | echo Done | ||
Line 196: | Line 197: | ||
</pre> | </pre> | ||
|} | |} | ||
'''''Note 1'':''' The service name '''mini_server_10''' this along with a unique port number allows all mini servers to be run alongside each other. | |||
'''''Note 2'':''' To avoid clashing with Uniform Server do not name the service '''Apache2'''. | |||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
== Command Line == | == Command Line == | ||
After installing the Apache service with the above batch file you can start and stop the " | After installing the Apache service with the above batch file you can start and stop the "mini_server_10" service at anytime using a command line this saves uninstalling the service every time you want to stop the server: | ||
* '''net stop | * '''net stop mini_server_10''' | ||
* '''net start | * '''net start mini_server_10''' | ||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
Line 211: | Line 216: | ||
=== Download === | === Download === | ||
Download this server from | Download this server from SourceForge [http://sourceforge.net/projects/miniserver Project Page] save the file '''mini_server_10.exe''' to drive '''C'''. | ||
'''''Note'':''' Check the | '''''Note'':''' Check out the mini server's [[Mini Servers: Support and download|support and download page]] detailing how to obtain full binaries for Apache and Perl. | ||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
=== Extract files === | === Extract files === | ||
Double click on | Double click on mini_server_10.exe, starts the extraction process. No need to change the folder destination, click extract, this creates a new folder '''mini_server_10''' containing the following files and folders: | ||
{| | {| | ||
Line 225: | Line 230: | ||
{|cellpadding="2" | {|cellpadding="2" | ||
|- | |- | ||
|valign="top"|'''Top level folder'''|| | |valign="top"|'''Top level folder'''||mini_server_10 contains two files:<br>1) '''install.bat''' - Double click to install and start server as a service.<br>2) '''uninstall.bat''' - Double click to stop and uninstall server service. | ||
|- | |- | ||
|'''cgi-bin folder:'''||Folder where you place all your Perl scripts.<br>Contains single page web site demo | |'''cgi-bin folder:'''||Folder where you place all your Perl scripts.<br>Contains single page web site demo test2. | ||
|- | |- | ||
|'''tmp folder:'''||Stores temporary files such as sessions | |'''tmp folder:'''||Stores temporary files such as sessions | ||
Line 239: | Line 244: | ||
|'''www folder:'''||This is where you put your web site or sites | |'''www folder:'''||This is where you put your web site or sites | ||
|- | |- | ||
|valign="top"|'''Test sites:'''|| | |valign="top"|'''Test sites:'''||test1 and test2 are test sites these are included to<br> | ||
provide an idea of the servers capability's. Delete these folders and<br> | provide an idea of the servers capability's. Delete these folders and<br> | ||
copy your sites into this folder (Referred to as the document root folder) | copy your sites into this folder (Referred to as the document root folder) | ||
|} | |} | ||
| | | | ||
[[Image: | [[Image:Uc_mini_server_10_dir.gif]] | ||
|} | |} | ||
Line 254: | Line 259: | ||
Testing is straight forward. | Testing is straight forward. | ||
# Install the server by double clicking on ''' | # Install the server by double clicking on '''install.bat''' (Checks config file, installs service and runs it) | ||
# Type '''<nowiki>http://localhost/</nowiki>''' into the browser address bar. | # Type '''<nowiki>http://localhost:8090/</nowiki>''' into the browser address bar. | ||
# An index page is displayed, check out the test site | # An index page is displayed, check out the test site test1. | ||
'''''Note 1'':''' The server automatically starts when your PC is restarted (that’s the reason for installing as a service.) | '''''Note 1'':''' The server automatically starts when your PC is restarted (that’s the reason for installing as a service.) | ||
Line 267: | Line 272: | ||
=== Your web site === | === Your web site === | ||
Open the folder www located in folder '''* | Open the folder www located in folder '''*mini_server_10\www''' delete everything in this folder and copy your site in to it. | ||
'''''Note'':''' Make sure one of your pages in folder www is named '''index.html''' or '''index.htm''', otherwise you will need to type a page name in every time to access your site. | '''''Note'':''' Make sure one of your pages in folder www is named '''index.html''' or '''index.htm''', otherwise you will need to type a page name in every time to access your site. | ||
e.g. <nowiki>http://localhost/somepage.html</nowiki> | e.g. <nowiki>http://localhost:8090/somepage.html</nowiki> | ||
== Problems - shebang == | == Problems - shebang == | ||
Line 280: | Line 285: | ||
* Reference Unix: '''<nowiki>#!/usr/bin/perl</nowiki>''' | * Reference Unix: '''<nowiki>#!/usr/bin/perl</nowiki>''' | ||
* Mini Portable Server: '''<nowiki>#!/usr/bin/perl</nowiki>''' | * Mini Portable Server: '''<nowiki>#!/usr/bin/perl</nowiki>''' | ||
* Mini Server run as service: '''<nowiki>#!c:/ | * Mini Server run as service: '''<nowiki>#!c:/mini_server_10/usr/bin/perl</nowiki>''' | ||
'''''Note'':''' If you use the Unix "shebang" on a mini server installed as a service you will receive this error message in | '''''Note'':''' If you use the Unix "shebang" on a mini server installed as a service you will receive this error message in | ||
Apache's error log: '''(OS 3) The system cannot find the path specified''' | Apache's error log: '''(OS 3) The system cannot find the path specified''' | ||
'''''[[#top | Top]]''''' | |||
== Change drive letter and or folder == | |||
The server requires a fixed location currently: c:\mini_server_10 | |||
You can move the server to any drive and folder for example e:\my_server\mini_server_10 | |||
To do this you need to edit threer files: | |||
* '''install.bat''' | |||
*''' uninstall.bat''' | |||
* '''httpd.conf''' (located in folder C:\mini_server_10\usr\local\apache2\conf) | |||
Find all occurrences of '''c:\mini_server_10''' and replace with '''e:\my_server\mini_server_10''' | |||
In addition you need to change all Perl scripts that use a Shebang: | |||
'''<nowiki>#</nowiki>!c:/mini_server_10/usr/bin/perl'''<br>To:<br> | |||
'''<nowiki>#</nowiki>!e:/my_server/mini_server_10/usr/bin/perl''' | |||
'''''[[#top | Top]]''''' | |||
== Change server default port == | |||
*Open file: '''httpd.conf''' (Located in folder: C:\mini_server_10\usr\local\apache2\conf) | |||
*Locate the lines:<br>Listen 8090<br>ServerName localhost:8090<br> | |||
*Change to:<br>Listen 8080<br>ServerName localhost:8080 | |||
This moves the server to the standard secondary web server port | |||
'''''Note'':''' Type '''<nowiki>http://localhost:8080</nowiki>''' into a browser to view the site. | |||
If port already in use try any value above 2000 | |||
'''''[[#top | Top]]''''' | |||
== Multi Servers == | |||
You can run more than one copy of this server as a service. | |||
To do this you need to: | |||
# Create a new folder and copy the contents of folder mini_server_10 to it. | |||
# Edit the files as for (Change drive letter and or folder) | |||
# Change the port see above. | |||
# Edit install.bat and uninstall.bat, change the service name from '''Apache10''' to something unique e.g. Apache10x | |||
'''''Note'':''' You can run the mini servers alongside Uniform Server 3.5-Apollo however you must start Uniform Server first. | |||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
== Summary == | == Summary == | ||
That concludes | That concludes server 3, I have shown how to run it either in a portable or service configuration. It is a very powerful mini server you can use for either testing or putting your web site on-line (production server). Perl is a very powerful CGI scripting language allowing you to produce dynamic web sites. | ||
Both PHP and Perl have integrated database support using this capability enhances functionality of any dynamic web site. To complete the mini server series I have included a [[Mini Servers: MySQL 5.0.51b Portable|mini MySQL server]]. | |||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
Line 296: | Line 348: | ||
{| | {| | ||
| [[Image: | | [[Image:Uc_small_logo.gif]] || [[User:Ric|Ric]] | ||
|} | |} | ||
Line 302: | Line 354: | ||
[[Category: UniCenter]] | [[Category: UniCenter]] | ||
[[Category: Mini Servers]] | [[Category: Mini Servers]] | ||
[[Category: Perl]] | |||
[[Category: Oily Rag]] | [[Category: Oily Rag]] | ||
[[Category: Self Install]] | [[Category: Self Install]] |