Mini Servers: Apache 2.2.9 Service: Difference between revisions

m
no edit summary
(New page: {{Uc nav mini servers}} Apache 2.2.9|right'''Mini server using Apache 2.2.9 Core run as service''' This page covers running our mini server (describe on the previ...)
 
mNo edit summary
Line 1: Line 1:
{{Uc nav mini servers}}
{{Uc nav mini servers}}
[[Image:Uc_mini_1a.gif|Apache 2.2.9|right]]'''Mini server using Apache 2.2.9 Core run as service'''
[[Image:uc_mini_1a.gif|Apache 2.2.9|right]]'''Mini Server 2 using Apache 2.2.9 Core run as service'''


This page covers running our mini server (describe on the previous page) as a service, its big brother Uniform Server 3.5-Apollo 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 Portable|previous page]]) as a service, its big brother Uniform Server 3.5-Apollo 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.


Interestingly I looked at the surgery performed on both Apache and Uniform Server, seems Uniform Server was mutilated beyond all recognition only the batch files survived while Apache remained reasonably recognisable.
Interestingly I looked at the surgery performed on both Apache and Uniform Server, seems Uniform Server was mutilated beyond all recognition only the batch files survived while Apache remained reasonably recognisable.
Line 35: Line 35:


=== 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:\uc_server_1b''', the drive must be specified and then any folders etc.
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_2''', 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 42: Line 42:


== 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 '''uc_server_1b''' 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.
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_2''' 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 8082 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:\uc_server_1b\usr\local\apache2\conf
!httpd.conf located in folder: C:\mini_server_2\usr\local\apache2\conf
|-style="background:#f5f5f5"
|-style="background:#f5f5f5"
|
|
<nowiki>#</nowiki> UniCenter - Very basic server<br>
<nowiki>#</nowiki> File name: http.conf<br>
<nowiki>#</nowiki> Author: Mike Gleaves <br>
<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> 14-7-2008
<nowiki>#</nowiki> V 1.0 14-7-2008
|-style="background:#f5f5f5"
|-style="background:#f5f5f5"
|
|
Line 67: Line 69:
<nowiki>#</nowiki> Basic settings <br>
<nowiki>#</nowiki> Basic settings <br>
<nowiki>#</nowiki> ======================================== <br>
<nowiki>#</nowiki> ======================================== <br>
&nbsp;Listen 80 <br>
&nbsp;Listen 8082 <br>
&nbsp;ServerName localhost:80<br>
&nbsp;ServerName localhost:8082<br>
&nbsp;ServerAdmin fred@www.somedomain.com <br>
&nbsp;ServerAdmin fred@www.somedomain.com <br>
&nbsp;UseCanonicalName Off <br>
&nbsp;UseCanonicalName Off <br>
Line 74: Line 76:
&nbsp;HostnameLookups Off <br>
&nbsp;HostnameLookups Off <br>
ServerTokens Prod <br>
ServerTokens Prod <br>
&nbsp;ServerRoot "'''c:/uc_server_1b'''/usr/local/apache2"<br>
&nbsp;ServerRoot "'''c:/mini_server_2'''/usr/local/apache2"<br>
&nbsp;DocumentRoot "'''c:/uc_server_1b'''/www"<br>
&nbsp;DocumentRoot "'''c:/mini_server_2'''/www"<br>
&nbsp;PidFile /logs/httpd.pid <br>
&nbsp;PidFile /logs/httpd.pid <br>
<IfModule mod_dir.c> <br>
<IfModule mod_dir.c> <br>
Line 105: Line 107:
</Directory>  
</Directory>  


<Directory "'''c:/uc_server_1b'''/www"> <br>
<Directory "'''c:/mini_server_2'''/www"> <br>
&nbsp;&nbsp;Order allow,deny <br>
&nbsp;&nbsp;Order allow,deny <br>
&nbsp;&nbsp;Allow from all <br>
&nbsp;&nbsp;Allow from all <br>
Line 133: Line 135:


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
== uc_install.bat ==
 
== 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 140: Line 143:
{|border="0" cellpadding="4" cellspacing="1" style="background:#222222"
{|border="0" cellpadding="4" cellspacing="1" style="background:#222222"
|-style="background:#e8e8e8"
|-style="background:#e8e8e8"
!uc_install.bat located in folder: C:\uc_server_1b
!install.bat located in folder: C:\mini_server_2
|-style="background:#f5f5f5"
|-style="background:#f5f5f5"
|
|
<pre style="border:none;padding:0;margin:0">
<pre style="border:none;padding:0;margin:0">
@echo off
echo.
echo.
c:\uc_server_1b\usr\local\apache2\bin\Apache.exe -k install -n "Apache2"
c:\mini_server_2\usr\local\apache2\bin\Apache.exe -k install -n "mini_server_2"
echo.
echo.
net start Apache2
net start mini_server_2
echo.
echo.
echo Type http://localhost into your browser to access server.
echo Type http://localhost:8082 into your browser to access server.
echo.
echo.
pause
pause
Line 158: Line 160:
'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''


== uc_uninstall.bat ==
== uninstall.bat ==
The uninstall batch file first stops the “Apache2” service and then proceeds to uninstall it.
The uninstall batch file first stops the “mini_server_2” 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"
!uc_uninstall.bat located in folder: C:\uc_server_1b
!uninstall.bat located in folder: C:\mini_server_2
|-style="background:#f5f5f5"
|-style="background:#f5f5f5"
|
|
<pre style="border:none;padding:0;margin:0">
<pre style="border:none;padding:0;margin:0">
@echo off
echo.
echo.
net stop Apache2
net stop mini_server_2
echo.
echo.
c:\uc_server_1b\usr\local\apache2\bin\Apache.exe -k uninstall -n "Apache2"
c:\mini_server_2\usr\local\apache2\bin\Apache.exe -k uninstall -n "mini_server_2"
echo.
echo.
echo Done
echo Done
Line 177: Line 178:
</pre>
</pre>
|}
|}
'''''Note 1'':''' The service name '''mini_server_2''' 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 "Apache2" service at anytime using a command line this saves uninstalling the service every time you want to stop the server:
After installing the Apache service with the above batch file you can start and stop the "mini_server_2" service at anytime using a command line this saves uninstalling the service every time you want to stop the server:


* '''net stop Apache2'''
* '''net stop mini_server_2'''
* '''net start Apache2'''
* '''net start mini_server_2'''


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
Line 192: Line 197:


=== Download ===
=== Download ===
Download this server from the mini server's [[Mini Servers: Support and download#UC Server 1b|Support and download page.]] Save the file uc_server_1b.exe to drive '''C'''.
Download this server from SourceForge [http://sourceforge.net/projects/miniserver Project Page] save the file '''mini_server_2.exe''' to drive '''C'''.


'''''Note'':''' Check the file's integrity using its MD5 a suitable checker '''winMd5Sum Portable''' can be found at [http://portableapps.com/apps Portable Apps] under Utilities.
'''''Note'':''' Check out the mini server's [[Mini Servers: Support and download|support and download page]] detailing how to obtain full binaries for Apache.


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


=== Extract files ===
=== Extract files ===
Double click on uc_server_1b.exe, starts the extraction process. No need to change the folder destination, click extract, this creates a new folder '''uc_server_1b''' containing two files and two folders.
Double click on mini_server_2.exe, starts the extraction process. No need to change the folder destination, click extract, this creates a new folder '''mini_server_2''' containing two files and two folders.


# '''uc_install.bat''' - Double click to install and start server as a service.
# '''install.bat''' - Double click to install and start server as a service.
# '''uc_uninstall.bat''' - Double click to stop and uninstall server service.
# '''uninstall.bat''' - Double click to stop and uninstall server service.
# '''usr''' - Folder containing the server.
# '''usr''' - Folder containing the server.
# '''www''' - Folder containing a test web site (delete this and place your site in this folder).
# '''www''' - Folder containing a test web site (delete contents of this folder and place your site in www).


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
Line 211: Line 216:
Testing is straight forward.
Testing is straight forward.


# Install the server by double clicking on '''uc_install.bat''' (Checks config file, installs service and runs it)
# 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:8082/</nowiki>''' into the browser address bar.
# An index page is displayed, check out the test site MPG1.
# An index page is displayed, check out the test site MPG1.


Line 224: Line 229:


=== Your web site ===
=== Your web site ===
Open the folder www located in folder '''*uc_server_1b\www''' delete everything in this folder and copy your site in to it.
Open the folder www located in folder '''*mini_server_2\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/somepage.html</nowiki>
'''''[[#top | Top]]'''''
== Change drive letter and or folder ==
The server requires a fixed location currently: c:\mini_server_2
You can move the server to any drive and folder for example e:\my_server\mini_server_2
To do this you need to edit three files:
* '''install.bat'''
*''' uninstall.bat'''
* '''httpd.conf''' (located in folder C:\mini_server_2\usr\local\apache2\conf)
Find all occurrences of '''c:\mini_server_2''' and replace with '''e:\my_server\mini_server_2'''
'''''[[#top | Top]]'''''
== Change server default port ==
*Open file: '''httpd.conf''' (Located in folder: C:\mini_server_2\usr\local\apache2\conf)
*Locate the lines:<br>Listen 8082<br>ServerName localhost:8082<br>
*Change to:<br>Listen 8080<br>ServerName localhost:8080
This moves the server to the standard secondaty 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_2 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 '''mini_server_2''' to something unique e.g. mini_server_2x
'''''Note'':''' You can run the mini servers alongside Uniform Server 3.5-Apollo however you must start Uniform Server first.
'''''[[#top | Top]]'''''
== Putting the server on-line ==
If connected to the Internet by a router to put the server on-line you need to forward port 8082 (or the port you have chosen to run the server on).


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


== Summary ==
== Summary ==
That concludes server 1, 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). The configuration file is clean allowing you to easily explore other Apache configurations.
I have shown how to run Apache 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). The configuration file is clean allowing you to easily explore other Apache configurations.


Shame it’s only capable of serving static pages, not to worry the next mini server has this covered with PHP.dynamic duo Apache and Uniform Server make an excellent basic portable server.  
If you want to make your server a little more private [[Mini Servers: Apache 2.2.9 Portable - Authentication|Mini Server 3]] provides basic authentication.


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
Line 242: Line 291:


{|
{|
| [[Image:uc_small_logo.gif]] || [[User:Ric|Ric]]
| [[Image:uc_small_logo.gif]] || [[User:WikiSysop|Ric]]
|}
|}


 
[[Category: To be published]]
[[Category: UniCenter]]
[[Category: UniCenter]]
[[Category: Mini Servers]]
[[Category: Mini Servers]]
[[Category: Oily Rag]]
[[Category: Oily Rag]]
[[Category: Self Install]]
[[Category: Self Install]]