Mini Servers: Apache 2.2.9 PHP 5.2.6 Portable: Difference between revisions
(New page: {{Uc nav mini servers}} Apache 2.2.9|right'''Mini server using Apache 2.2.9 and PHP 5.2.6 Core''' This mini server packs a real punch; trouble is it also packs a ...) |
m (Text replace - "projects/uniformserver" to "projects/miniserver") |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Uc nav mini servers}} | {{Uc nav mini servers}} | ||
[[Image:Uc_mini_2a.gif|Apache 2.2.9|right]]'''Mini | [[Image:Uc_mini_2a.gif|Apache 2.2.9|right]]'''Mini Server 6 using Apache 2.2.9 and PHP 5.2.6 Core''' | ||
This mini server packs a real punch; trouble is it also packs a real disk hit, increases server size from | This mini server packs a real punch; trouble is it also packs a real disk hit, increases server size from 1MB to 6MB. However adding the PHP 5.2.6 core greatly extends the server's power. | ||
Hey not much use without a MYSQL server! So you have never considered file databases as an alternative. The support files include an excellent example; it’s a quest book (Version 1.7.2) from the DigiOz stable. A single file database, code is well commented and easy to follow. These chaps produce height quality open source software, their site is more than worth a visit, and forum is friendly check out their tutorials. I would like to thank Pete for his kind permission to use the DigiOz logo and use the quest book as an example. | Hey not much use without a MYSQL server! So you have never considered file databases as an alternative. The support files include an excellent example; it’s a quest book (Version 1.7.2) from the [http://www.digioz.com/ DigiOz] stable. A single file database, code is well commented and easy to follow. These chaps produce height quality open source software, their site is more than worth a visit, and forum is friendly check out their tutorials. I would like to thank Pete for his kind permission to use the DigiOz logo and use the quest book as an example. | ||
Note: Check the support files section for download details. | Note: Check the [[#Support files|support files]] section for server download details. | ||
== Security == | == Security == | ||
Line 30: | Line 30: | ||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
== Configuring Apache == | == Configuring Apache == | ||
Using the configuration file from [[Mini Servers: Apache 2.2.9 Portable| | Using the configuration file from [[Mini Servers: Apache 2.2.9 Portable|Mini Server 1a]] very few changes are required these I have highlighted in bold. | ||
{|border="0" cellpadding="4" cellspacing="1" style="background:#222222" | {|border="0" cellpadding="4" cellspacing="1" style="background:#222222" | ||
Line 38: | 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> 14-7-2008 | <nowiki>#</nowiki> Supports PHP<br> | ||
<nowiki>#</nowiki> V 1.0 14-7-2008 | |||
| | | | ||
| | ||
Line 62: | Line 64: | ||
<nowiki>#</nowiki> ======================================== <br> | <nowiki>#</nowiki> ======================================== <br> | ||
'''PHPIniDir "/usr/local/php/"''' <br> | '''PHPIniDir "/usr/local/php/"''' <br> | ||
Listen | '''Listen 8086''' <br> | ||
ServerName localhost: | ServerName '''localhost:8086'''<br> | ||
ServerAdmin fred@www.somedomain.com <br> | ServerAdmin fred@www.somedomain.com <br> | ||
UseCanonicalName Off <br> | UseCanonicalName Off <br> | ||
Line 81: | Line 83: | ||
'''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.php''' to this list. | '''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.php''' to this list. | ||
'''''Note'':''' Moved server port to 8086 prevents clashing with other servers. | |||
|-style="background:#f5f5f5" | |-style="background:#f5f5f5" | ||
| | | | ||
Line 171: | Line 175: | ||
PHP 5.2.6 zip package [9,516Kb] - 3 May 2008 located in the “Windows Binaries” section | PHP 5.2.6 zip package [9,516Kb] - 3 May 2008 located in the “Windows Binaries” section | ||
After downloading unzip to any folder, locate files '''php5apache2_2.dll''', '''php5ts.dll''' and '''php.ini-recommended''' copy these to mini server folder '''*\ | After downloading unzip to any folder, locate files '''php5apache2_2.dll''', '''php5ts.dll''' and '''php.ini-recommended''' copy these to mini server folder '''*\mini_server_6\udrive\usr\local\php''' | ||
Rename the file '''php.ini-recommended''' to '''php.ini''' | Rename the file '''php.ini-recommended''' to '''php.ini''' | ||
Line 180: | Line 184: | ||
== php.ini == | == php.ini == | ||
Open '''php.ini''' have a read, yep its not a bedtime classic it’s a long confusing read. So what do you change! Surprisingly very little, to get you up and running the following table shows the lines that | Open '''php.ini''' have a read, yep its not a bedtime classic it’s a long confusing read. So what do you change! Surprisingly very little, to get you up and running the following table shows the lines that require changing: | ||
{|border="0" cellpadding="2" cellspacing="1" style="background:#000000" | {|border="0" cellpadding="2" cellspacing="1" style="background:#000000" | ||
|-style="background:#e8e8e8" | |-style="background:#e8e8e8" | ||
!Line | !Line | ||
!php.ini located in folder: *\ | !php.ini located in folder: *\mini_server_6\udrive\usr\local\php | ||
|-style="background:#f5f5f5" | |-style="background:#f5f5f5" | ||
|131||short_open_tag = On | |131||short_open_tag = On | ||
Line 232: | Line 236: | ||
For extension you enable the appropriate line in the php.ini file remember to copy a corresponding dll into the extensions folder. | For extension you enable the appropriate line in the php.ini file remember to copy a corresponding dll into the extensions folder. | ||
'''''Note 2'':''' Line 466 '''register_globals = Off''' this is the default keep it that way. There are security issues if you tun it on. | '''''Note 2'':''' Line 466 '''register_globals = Off''' this is the default keep it that way. There are security issues if you tun it on. Checks out the included example site explaining why register_globals are evil. | ||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
== Testing == | == Testing == | ||
* Start the server by double clicking on ''' | * Start the server by double clicking on '''server_start.bat''' | ||
* Type '''<nowiki>http://localhost</nowiki>''' into your browser address bar. | * Type '''<nowiki>http://localhost:8086</nowiki>''' into your browser address bar. | ||
* Check | * Check test site runs, this confirms the server is working. | ||
* Close the server using ''' | * Close the server using '''server_stop.bat''' | ||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
Line 364: | Line 369: | ||
=== Download === | === Download === | ||
Download this server from | Download this server from SourceForge [http://sourceforge.net/projects/miniserver/files/MiniServer/MiniServer_%20Apache%202.2.9%20PHP%205.2.6%20Portable/ Project Page] save the file '''mini_server_6.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 PHP. | ||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
=== Extract files === | === Extract files === | ||
Double click on | Double click on mini_server_6.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_6''' containing the following: | ||
{| | {| | ||
|- | |- | ||
Line 379: | Line 384: | ||
{|cellpadding="2" | {|cellpadding="2" | ||
|- | |- | ||
|valign="top"|'''Top level folder'''|| | |valign="top"|'''Top level folder'''||mini_server_6 contains two files:<br>1) '''server_start.bat''' - Double click to start the<br>2) '''server_stop.bat''' - Double click to stop server | ||
|- | |- | ||
|'''program folder''':||Uniform Server's programs that make the server portable | |'''program folder''':||Uniform Server's programs that make the server portable | ||
Line 391: | Line 396: | ||
|'''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''':||guestbook, | |valign="top"|'''Test sites''':||guestbook, 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_6_dir.gif]] | ||
|} | |} | ||
Line 406: | Line 411: | ||
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 http://localhost/ into the browser address bar. | # Type '''<nowiki>http://localhost:8086/</nowiki>''' into the browser address bar. | ||
# An index page is displayed, check out | # An index page is displayed, check out test sites MPG1, MPG2 and guestbook. | ||
# Stop the server by double clicking on | # Stop the server by double clicking on server_stop.bat | ||
'''''[[#top | Top]]''''' | |||
=== Your web site === | |||
Open the folder www located in folder '''*mini_server_6\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''', '''index.htm''' or '''index.php''', otherwise you will need to type a page name in every time to access your site. | |||
e.g. <nowiki>http://localhost:8086/somepage.html</nowiki> | |||
'''''[[#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]]''''' | '''''[[#top | Top]]''''' | ||
== | == Change server default port == | ||
Open | *Open file: '''httpd.conf''' (Located in folder: \mini_server_6\udrive\usr\local\apache2\conf) | ||
*Locate the lines:<br>Listen 8086<br>ServerName localhost:8086<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_6 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 430: | Line 462: | ||
This mini server is ideal for learning PHP its compact size allows you have several copies installed on a USB pen drive each with different test applications. I have covered how to secure the server and PHP in the real world you also must pay attention to securing your PHP scripts. Included with the support files is a guest book script that demonstrates some of the techniques used. | This mini server is ideal for learning PHP its compact size allows you have several copies installed on a USB pen drive each with different test applications. I have covered how to secure the server and PHP in the real world you also must pay attention to securing your PHP scripts. Included with the support files is a guest book script that demonstrates some of the techniques used. | ||
When you change the scripts configuration file hopefully you will notice there is a fundamental problem, on the [[Mini Servers: | When you change the scripts configuration file hopefully you will notice there is a fundamental problem, on the [[Mini Servers: Apache 2.2.9 PHP 5.2.6 Service|next page]] I show how to resolve this, in addition cover some defensive programming. | ||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
Line 437: | Line 469: | ||
{| | {| | ||
| [[Image: | | [[Image:Uc_small_logo.gif]] || [[User:Ric|Ric]] | ||
|} | |} | ||
[[Category: UniCenter]] | [[Category: UniCenter]] | ||
[[Category: Mini Servers]] | [[Category: Mini Servers]] | ||
[[Category: PHP]] | |||
[[Category: Oily Rag]] | [[Category: Oily Rag]] | ||
[[Category: Self Install]] | [[Category: Self Install]] |
Latest revision as of 16:11, 17 October 2012
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 6 using Apache 2.2.9 and PHP 5.2.6 Core
This mini server packs a real punch; trouble is it also packs a real disk hit, increases server size from 1MB to 6MB. However adding the PHP 5.2.6 core greatly extends the server's power.
Hey not much use without a MYSQL server! So you have never considered file databases as an alternative. The support files include an excellent example; it’s a quest book (Version 1.7.2) from the DigiOz stable. A single file database, code is well commented and easy to follow. These chaps produce height quality open source software, their site is more than worth a visit, and forum is friendly check out their tutorials. I would like to thank Pete for his kind permission to use the DigiOz logo and use the quest book as an example.
Note: Check the support files section for server download details.
Security
In order for PHP 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.
A well-written program like the guest book will have these holes plugged, however an application remains venerable if server software leave other security holes open. Security issues are a two way street which I attempt to cover later.
Anyway I digress before looking at security issues lets get the server up and running with PHP.
Specification
The server has the following specification:
- Server shall be portable
- Static HTML and Dynamic PHP pages shall be served.
- 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 PHP core shall be used it is relatively large at 5MB however this is small in comparison to the complete PHP package of 25MB.
If the basic core does not meet your requirements download the full PHP package and add extensions as required.
Configuring Apache
Using the configuration file from Mini Server 1a very few changes are required these I have highlighted in bold.
httpd.conf located in folder: *\udrive\usr\local\apache2\conf | Comments |
---|---|
# File name: http.conf |
|
# ================================================== |
LoadModule php5_module: Module required to handle PHP5 pages. |
# ======================================== |
PHPIniDir: Informs PHP where to find the php.ini file. Note: I found without this line php.ini was correctly located. However I would recommend using it otherwise PHP swans off looking in various locations (see info). The line guarantees correct php.ini file is used (multi servers or individual installations will place other php.ini files on your PC resulting in conflicts). 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.php to this list. Note: Moved server port to 8086 prevents clashing with other servers. |
# ======================================== |
|
# ======================================== <Directory "/www"> |
|
# ======================================== |
Note: The AddType directive maps a content-type to a file extension. Without this line pages will be served unprocessed in plain text and reveal your PHP code. |
# ======================================== |
|
Information
I have shown below the search order PHP performs to locate its php.ini file no real need to understand this just make sure to include a PHPIniDir command in the Apache configuration file.
- SAPI module specific location:
- PHPIniDir directive in Apache 2
- -c command line option in CGI and CLI
- php_ini parameter in NSAPI
- PHP_INI_PATH environment variable in THTTPD
- The PHPRC environment variable (Before PHP 5.2.0 this was checked after the registry key mentioned below.)
- HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath (Windows Registry location)
- Current working directory (for CLI)
- The web server’s directory (for SAPI modules)
- Directory of PHP (If Windows)
- Windows directory (C:\windows or C:\winnt)
- –with-config-file-path compile time option
PHP - Core
Although our mini server only uses the PHP core you need to download the full package to extract it. (OK I have included a core in the support files) Check the PHP site and download any newer version this allows you to install any extensions you require. On the other hand perhaps you want to run an earlier version of PHP. The following outlines how to install PHP on our mini server.
Download site [php.net http://www.php.net/downloads.php php.net]
We are not interested in installing PHP on our PC hence download a zip package:
PHP 5.2.6 zip package [9,516Kb] - 3 May 2008 located in the “Windows Binaries” section
After downloading unzip to any folder, locate files php5apache2_2.dll, php5ts.dll and php.ini-recommended copy these to mini server folder *\mini_server_6\udrive\usr\local\php
Rename the file php.ini-recommended to php.ini
Believe it or not that’s all there is to the installation process, all that remains is to modify the php.ini file.
php.ini
Open php.ini have a read, yep its not a bedtime classic it’s a long confusing read. So what do you change! Surprisingly very little, to get you up and running the following table shows the lines that require changing:
Line | php.ini located in folder: *\mini_server_6\udrive\usr\local\php |
---|---|
131 | short_open_tag = On |
149 | output_buffering = Off |
212 | allow_call_time_pass_reference = On |
229 | safe_mode_include_dir = ".;/usr/local/PHP/includes;/usr/local/PHP/pear" |
297 | expose_php = Off |
355 | error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT |
407 | track_errors = On |
431 | error_log = logs/logs.log |
455 | variables_order = "EGPCS" |
492 | magic_quotes_gpc = On |
495 | magic_quotes_runtime = Off |
498 | magic_quotes_sybase = Off |
525 | include_path = ".;/usr/local/PHP/includes;/usr/local/PHP/pear" |
537 | user_dir = "/www" |
541 | extension_dir = "/usr/local/PHP/extensions" |
598 | upload_tmp_dir = /tmp |
601 | upload_max_filesize = 10M |
757 | sendmail_from = me@localhost.com |
1045 | session.save_path = "/tmp/" |
1332 | soap.wsdl_cache_dir="/tmp" |
Note 1: Our mini server does not require the folders pear, includes or extensions however including these in the ini file will make it easier when you want to add extensions or includes at a later date.
For extension you enable the appropriate line in the php.ini file remember to copy a corresponding dll into the extensions folder.
Note 2: Line 466 register_globals = Off this is the default keep it that way. There are security issues if you tun it on. Checks out the included example site explaining why register_globals are evil.
Testing
- Start the server by double clicking on server_start.bat
- Type http://localhost:8086 into your browser address bar.
- Check test site runs, this confirms the server is working.
- Close the server using server_stop.bat
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
Make sure the following are set in the PHP configuration file:
- expose_php = Off – Prevents reports in every request that PHP is being used to process the request, and what version of PHP is installed. makes it a little more difficult for automated attacks,
If you download the mini server on the index page you will find a link named PHP info this runs a page containing a small script:
info.php located in folder www |
---|
<? |
Delete the file info.php before you put your server on-line it exposes your PHP configuration and detailed server information.
Note: You can disable the function by setting this line in the php.ini configuration file: disable_functions = "phpinfo"
The above are not real security measures they just provide a little fence to be jumped when a script kiddie wants to play.
Disable functions
I previously mentioned don’t install what you do not use hence disable all unused functions. This really is an impractical option however there are a number of system functions that should be disabled:
phpinfo | |
dir | — Return an instance of the Directory class |
virtual | — Perform an Apache sub-request |
popen | — Opens process file pointer |
pclose | — Closes process file pointer |
putenv | — Sets the value of an environment variable |
dl | — Loads a PHP extension at runtime |
exec | — Execute an external program |
shell_exec | — Execute command via shell and return the complete output as a string |
system | — Execute an external program and display the output |
passthru | — Execute an external program and display raw output |
proc_open | — Execute a command and open file pointers for input/output |
proc_terminate | — Kills a process opened by proc_open |
proc_get_status | — Get information about a process opened by proc_open() |
proc_close | — Close a process opened by proc_open() and return the exit code of that process. |
pfsockopen | — Open persistent Internet or Unix domain socket connection |
pcntl_exec | — Executes specified program in current process space |
posix_kill | — Send a signal to a process |
posix_mkfifo | — Create a fifo special file (a named pipe) |
posix_setpgid | — Set process group id for job control |
posix_setsid | — Make the current process a session leader |
posix_setuid | — Set the UID of the current process |
escapeshellcmd | — Escape shell metacharacters |
escapeshellarg | — Escape a string to be used as a shell argument |
readfile | — Reads a file and writes it to the output buffer. |
ini_alter | — Alias of ini_set() |
parse_ini_file | — Parse a configuration file |
show_source | — Alias of highlight_file() |
curl_exec | — Perform a cURL session |
Your disable function line will look like this:
disable_functions = "phpinfo, dir, virtual, popen, pclose, putenv, dl, exec, shell_exec, system, passthru, proc_open, proc_terminate, proc_get_status, proc_close, pfsockopen, pcntl_exec, apache_child_terminate, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, escapeshellcmd, escapeshellarg, readfile, ini_alter, parse_ini_file, show_source, curl_exec" |
Backticks are dangerous when looking at a line of code they can be confused with a single quote . What follows a backtick is system commands never let anyone have access to this.
Note: Backticks are an alias for shell_exec() when shell_exec() is disabled backticks are also disabled. |
You need to edit php.ini to include phpinfo I have added the other functions, note when disabling functions be careful that you don't break any features you need hence always test.
That completes plugging the server holes, however what I have covered does not guarantee the server is one hundred percent secure. Think of the above as a pointer, it provides search terms you should be using when doing further research into hardening your server. I mentioned its a two way street any application must also be hardened this I cover on the next page.
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_6.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 PHP.
Extract files
Double click on mini_server_6.exe, starts the extraction process.
No need to change the folder destination, click extract, this creates a new folder mini_server_6 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:8086/ into the browser address bar.
- An index page is displayed, check out test sites MPG1, MPG2 and guestbook.
- Stop the server by double clicking on server_stop.bat
Your web site
Open the folder www located in folder *mini_server_6\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, index.htm or index.php, otherwise you will need to type a page name in every time to access your site.
e.g. http://localhost:8086/somepage.html
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_6\udrive\usr\local\apache2\conf)
- Locate the lines:
Listen 8086
ServerName localhost:8086 - 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_6 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 PHP its compact size allows you have several copies installed on a USB pen drive each with different test applications. I have covered how to secure the server and PHP in the real world you also must pay attention to securing your PHP scripts. Included with the support files is a guest book script that demonstrates some of the techniques used.
When you change the scripts configuration file hopefully you will notice there is a fundamental problem, on the next page I show how to resolve this, in addition cover some defensive programming.
Ric |