Mini Servers: Apache 2.2.9 Perl 5.10 Portable: Difference between revisions
(New page: {{Uc nav mini servers}} Apache 2.2.9|right'''Mini server using Apache 2.2.9 and Activestate Perl 5.10 Core''' This mini server packs a real punch; trouble is it a...) |
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 9 using Apache 2.2.9 and Activestate Perl 5.10 Core''' | ||
This mini server packs a real punch; trouble is it also packs a real disk hit, using the full version of Perl you are looking at 53M hence I have used only the core and few modules reducing the server to about 3MB. It still provides usful features for dynamic pages adding a Perl core greatly extends the server's power. | This mini server packs a real punch; trouble is it also packs a real disk hit, using the full version of Perl you are looking at 53M hence I have used only the core and few modules reducing the server to about 3MB. It still provides usful features for dynamic pages adding a Perl core greatly extends the server's power. | ||
Note: Check the support files section for download details. | Note: Check the [[#Support files|support files]] section for download details. | ||
== Security == | == Security == | ||
Line 30: | Line 30: | ||
== Configuring Apache == | == Configuring Apache == | ||
Using the configuration file from [[Mini Servers: Apache 2.2.9 Portable|server 1]] very few changes are required however a new section is required to implement a safe location for CGI scripts. I have highlighted the changes and new section in bold. | Using the configuration file from [[Mini Servers: Apache 2.2.9 Portable|server 1]] very few changes are required however a new section is required to implement a safe location for CGI scripts. I have highlighted the changes and new section in bold. | ||
Note: I have moved the server to port 8089 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" | ||
Line 37: | Line 38: | ||
|-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 16-7-2008 | |||
| | | | ||
| | ||
Line 66: | Line 69: | ||
<nowiki>#</nowiki> Basic settings <br> | <nowiki>#</nowiki> Basic settings <br> | ||
<nowiki>#</nowiki> ======================================== <br> | <nowiki>#</nowiki> ======================================== <br> | ||
Listen | '''Listen 8089''' <br> | ||
ServerName localhost: | '''ServerName localhost:8089'''<br> | ||
ServerAdmin fred@www.somedomain.com <br> | ServerAdmin fred@www.somedomain.com <br> | ||
UseCanonicalName Off <br> | UseCanonicalName Off <br> | ||
Line 168: | Line 171: | ||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
== Perl - Core == | == Perl - Core == | ||
Although our mini server only uses the Perl core you need to download the full package to extract it. (OK I have included a core in the support files) Check the Activestate site and download any newer version this allows you to install any libraries you require. On the other hand perhaps you want to run an earlier version of Perl. The following outlines how to install Perl on our mini server. | Although our mini server only uses the Perl core you need to download the full package to extract it. (OK I have included a core in the support files) Check the Activestate site and download any newer version this allows you to install any libraries you require. On the other hand perhaps you want to run an earlier version of Perl. The following outlines how to install Perl on our mini server. | ||
Line 175: | Line 179: | ||
* The mini servers use ''' ActivePerl-5.10.0.1003-MSWin32-x86-285500.zip''' downloadable from [http://downloads.activestate.com/ActivePerl/Windows/5.10/ Activestate download page]. | * The mini servers use ''' ActivePerl-5.10.0.1003-MSWin32-x86-285500.zip''' downloadable from [http://downloads.activestate.com/ActivePerl/Windows/5.10/ Activestate download page]. | ||
* After downloading unzip to any folder, locate the files '''perl.exe''' and '''perl510.dll''' copy them to the mini server folder '''<nowiki>*</nowiki>\ | * After downloading unzip to any folder, locate the files '''perl.exe''' and '''perl510.dll''' copy them to the mini server folder '''<nowiki>*</nowiki>\mini_server_9\udrive\usr\bin''' | ||
* Create a new folder <nowiki>*</nowiki>'''\ | * Create a new folder <nowiki>*</nowiki>'''\mini_server_9\udrive\usr\lib''' and add libraries as required. (I have included a small number of library elements in the support files) | ||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
Line 185: | Line 189: | ||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
=== Testing === | === Testing === | ||
Double click on | Double click on '''server_start.bat''' and check the server runs. | ||
Type <nowiki>http://localhost:8089</nowiki> into your browser address bar. | |||
=== Security === | === Security === | ||
Line 205: | Line 211: | ||
=== Download === | === Download === | ||
Download this server from | Download this server from SourceForge [http://sourceforge.net/projects/miniserver Project Page] save the file '''mini_server_9.exe''' to any folder of your choice. | ||
'''''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_9.exe, starts the extraction process. | ||
No need to change the folder destination, click extract, this creates a new folder ''' | No need to change the folder destination, click extract, this creates a new folder '''mini_server_9''' containing the following: | ||
{| | {| | ||
|- | |- | ||
Line 220: | Line 226: | ||
{|cellpadding="2" | {|cellpadding="2" | ||
|- | |- | ||
|valign="top"|'''Top level folder'''|| | |valign="top"|'''Top level folder'''||mini_server_9 contains two files:<br>1) '''server_start.bat''' - Double click to start the<br>2) '''server_stop.bat''' - Double click to stop server | ||
|- | |- | ||
|'''cgi-bin folder:'''||Contains demo scripts and single page web site. | |'''cgi-bin folder:'''||Contains demo scripts and single page web site. | ||
Line 236: | Line 242: | ||
|'''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_9_dir.gif]] | ||
|} | |} | ||
Line 251: | Line 257: | ||
Testing is straight forward. | Testing is straight forward. | ||
# Start the server by double clicking on ''' | # Start the server by double clicking on '''server_start.bat''' (automatically detects free drive letter creates new virtual drive and runs the server.) | ||
# Start a web browser. | # Start a web browser. | ||
# Type '''<nowiki>http://localhost/</nowiki>''' into the browser address bar. | # Type '''<nowiki>http://localhost:8089/</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''','''test2''' (Perl single page web site). | ||
# Stop the server by double clicking on ''' | # Stop the server by double clicking on '''server_stop.bat''' | ||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
=== Your web site === | === Your web site === | ||
Open the folder www located in folder '''* | Open the folder www located in folder '''*mini_server_9\udrive\www''' (Note * is the path to the folder you extracted the server files) delete everything in '''www''' and copy your site into 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:8089/somepage.html</nowiki> | ||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
Line 279: | Line 281: | ||
* 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 Virtual Drive == | |||
The server automatically detects the first free drive letter and uses that to run the server on. | |||
You can override this in one of two ways: | |||
# Start the server using a drive parameter for example: '''server_start.bat z''' this forces the server to use drive z | |||
# Edit server_start.bat, locate the following line:<br> '''rem set Disk=w''' <br>Remove the rem and replace w with the letter you want to use for example:<br> '''set Disk=x''' Forces the server to use drive letter x | |||
'''''[[#top | Top]]''''' | |||
== Change server default port == | |||
*Open file: '''httpd.conf''' (Located in folder: \mini_server_9\udrive\usr\local\apache2\conf) | |||
*Locate the lines:<br>Listen 8089<br>ServerName localhost:8089<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 == | |||
If you wish to run several mini servers at the same time create a new folder for each server and copy contents of mini_server_9 into each of these. | |||
Change the server port for each server to be unique. The servers may be started in any order. | |||
'''''Note'':''' You can run the mini servers alongside Uniform Server 3.5-Apollo however you must start Uniform Server first. | |||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
Line 300: | Line 333: | ||
{| | {| | ||
| [[Image: | | [[Image:Uc_small_logo.gif]] || [[User:Ric|Ric]] | ||
|} | |} | ||
Line 306: | Line 339: | ||
[[Category: UniCenter]] | [[Category: UniCenter]] | ||
[[Category: Mini Servers]] | [[Category: Mini Servers]] | ||
[[Category: Perl]] | |||
[[Category: Oily Rag]] | [[Category: Oily Rag]] | ||
[[Category: Self Install]] | [[Category: Self Install]] |
Revision as of 14:31, 17 August 2008
Mini Servers: Introduction | Support | Server 1 - Portable | Server 2 - Service | Server 3 - Portable Authentication | Server 4 - Portable Authen. SSL | Server 5 - SSL Standalone | Browsers dislike self-signed certificates | Server 6 - PHP 5.2.6 Portable | Server 7 - PHP 5.2.6 Service | Server 8 - MySQL Support | Guest Book | Server 9 - Perl 5.2.6 Portable | Server 10 - Perl 5.2.6 Service | Server 11 - MySQL 5.0.67 Portable | Server 12 - MySQL 5.0.67 Service | Server 13 - MySQL 4.1.22 Portable | Server 14 - MySQL 4.1.22 Service | phpMyAdmin - Mini support | MySQL - General problems |
Mini Servers: Compact but fully functional. |
Mini Server 9 using Apache 2.2.9 and Activestate Perl 5.10 Core
This mini server packs a real punch; trouble is it also packs a real disk hit, using the full version of Perl you are looking at 53M hence I have used only the core and few modules reducing the server to about 3MB. It still provides usful features for dynamic pages adding a Perl core greatly extends the server's power.
Note: Check the support files section for download details.
Security
In order for Perl applications to perform their task they need to interact with the underlying programs if a security hole exists between interactions it can be exploited. Exploitation occurs only when data is returned by a user! or if the script is malicious.
Hence use well-written scripts, it is standard practice to confine scripts to a separate folder known as the cgi-bin.
Lets get the server up and running with Perl.
Specification
The server has the following specification:
- Server shall be portable
- Static HTML and Dynamic Perl pages shall be served.
- SSI shall be enabled
- The server shall log all web requests.
- All unused modules shall be disabled.
Our mini server is intended to be small in keeping with this philosophy only the Perl core and a few library elements shall be used it is relatively large at 2MB however this is small in comparison to the complete Perl package of 50MB.
If the basic core and included library elements do not meet your requirements download the full Perl package and add libraries as required.
Configuring Apache
Using the configuration file from server 1 very few changes are required however a new section is required to implement a safe location for CGI scripts. I have highlighted the changes and new section in bold.
Note: I have moved the server to port 8089 prevents clashing with other servers.
httpd.conf located in folder: *\udrive\usr\local\apache2\conf | Comments |
---|---|
# File name: http.conf |
|
# ================================================ |
LoadModule alias_module: Module required to handle alias directives LoadModule cgi_module: Module required to handle CGI scripts "Perl". LoadModule include_module: Allows a page to be passed for SSI (Server side includes) embedded commands allow a page to call CGI scripts. |
# ======================================== |
DirectoryIndex: When a user requests a page supplying only a folder name (example fred.com) the index page is automatically returned by default. Note you can have more than one index page in the same folder with a different file extension. Order of priority left to right, first one found in the list is returned, all other are ignored. I have added index.pl and index.cg to this list. AddHandler server-parsed: Pages with a file extension that is in the list are processed by Apache for embedded SSI commands. |
# ======================================== |
|
# ======================================== <Directory "/www"> |
Options FollowSymLinks: The Options directive controls which server features are available in a particular directory. The restrictive parameters specified for the root directory <Directory /> , Options is set to only FollowSymLinks. No features are enabled, except that the server is allowed to follow symbolic links in the root directory. Document root folder <Directory "/www"> Options: Indexes: Permits the server to generate a directory listing for a directory if no DirectoryIndex (for example, index.html) is specified. FollowSymLinks: Allows the server to follow symbolic links in this directory. |
# ======================================== <Directory "/cgi-bin"> |
The ScriptAlias directive defines where CGI scripts are located. A special directory known as cgi-bin outside of the DocumentRoot contains your server-side executable files and scripts. This prevents them being directly accessible over the Internet. |
# ======================================== |
|
# ======================================== |
|
Perl - Core
Although our mini server only uses the Perl core you need to download the full package to extract it. (OK I have included a core in the support files) Check the Activestate site and download any newer version this allows you to install any libraries you require. On the other hand perhaps you want to run an earlier version of Perl. The following outlines how to install Perl on our mini server.
Download
We are not interested in installing Perl on our PC hence download a zip package
- The mini servers use ActivePerl-5.10.0.1003-MSWin32-x86-285500.zip downloadable from Activestate download page.
- After downloading unzip to any folder, locate the files perl.exe and perl510.dll copy them to the mini server folder *\mini_server_9\udrive\usr\bin
- Create a new folder *\mini_server_9\udrive\usr\lib and add libraries as required. (I have included a small number of library elements in the support files)
Perl ini
Believe it or not that’s all there is to the installation process. A Perl ini file is not required its provided in the core.
Testing
Double click on server_start.bat and check the server runs.
Type http://localhost:8089 into your browser address bar.
Security
When testing you need as much information as possible however when you put your servers on-line its best to restrict what you make public.
Restrict public Information:
Make sure the following are set in the Apache configuration file:
- ServerTokens Prod – Prevents exposing server information makes it a little more difficult for automated attacks, which scan for vulnerable versions of Apache or its modules.
- ServerSignature Off - Suppresses the error line which exposes the server version number, virtual host ServerName, "mailto:" reference to the ServerAdmin
The above are not real security measures they just provide a little fence to be jumped when a script kiddie wants to play.
Support files
Each mini server is complete and zipped into a single self-extracting archive file.
Download
Download this server from SourceForge Project Page save the file mini_server_9.exe to any folder of your choice.
Note: Check out the mini server's support and download page detailing how to obtain full binaries for Apache and Perl.
Extract files
Double click on mini_server_9.exe, starts the extraction process.
No need to change the folder destination, click extract, this creates a new folder mini_server_9 containing the following:
|
Test
Testing is straight forward.
- Start the server by double clicking on server_start.bat (automatically detects free drive letter creates new virtual drive and runs the server.)
- Start a web browser.
- Type http://localhost:8089/ into the browser address bar.
- An index page is displayed, check out the test site test1,test2 (Perl single page web site).
- Stop the server by double clicking on server_stop.bat
Your web site
Open the folder www located in folder *mini_server_9\udrive\www (Note * is the path to the folder you extracted the server files) delete everything in www and copy your site into 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.
e.g. http://localhost:8089/somepage.html
Problems - shebang
I found this to be a real pain you need to change the “shebang” depending on how you run the mini server, portable or as a service. If you're running CGI's on Windows use the portable server, this will allow you to move the scripts to a Unix system without change!
The following lists the “shebang” required to get your cgi scripts working:
- Reference Unix: #!/usr/bin/perl
- Mini Portable Server: #!/usr/bin/perl
- Mini Server run as service: #!c:/mini_server_10/usr/bin/perl
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
Change Virtual Drive
The server automatically detects the first free drive letter and uses that to run the server on. You can override this in one of two ways:
- Start the server using a drive parameter for example: server_start.bat z this forces the server to use drive z
- Edit server_start.bat, locate the following line:
rem set Disk=w
Remove the rem and replace w with the letter you want to use for example:
set Disk=x Forces the server to use drive letter x
Change server default port
- Open file: httpd.conf (Located in folder: \mini_server_9\udrive\usr\local\apache2\conf)
- Locate the lines:
Listen 8089
ServerName localhost:8089 - Change to:
Listen 8080
ServerName localhost:8080
This moves the server to the standard secondary web server port
Note: Type http://localhost:8080 into a browser to view the site.
If port already in use try any value above 2000
Multi Servers
If you wish to run several mini servers at the same time create a new folder for each server and copy contents of mini_server_9 into each of these.
Change the server port for each server to be unique. The servers may be started in any order.
Note: You can run the mini servers alongside Uniform Server 3.5-Apollo however you must start Uniform Server first.
Summary
This mini server is ideal for learning Perl its compact size allows you have several copies installed on a USB pen drive each with different test applications.
I must stress that it’s very compact because it uses the bare minimum of Perl’s modules. Download the full version and select the modules you require this page will help if you have problems.
This server can also be run as a service covered on the next page.
Ric |