Professional Documents
Culture Documents
Install Wamp SSL PDF
Install Wamp SSL PDF
Below are basic instructions which should get you an Apache Web Server up and
running, which supports PHP and MySQL.
The versions of software that I used for the following instructions are:-
z Enter a password
z ; Enable root access from remote machines
z
Open Notepad and type the following and save it in the root of C:\ as my.cnf
[mysqld]
basedir=d:/mysql5027/
datadir=d:/mysql5027/data/
You only need to enter the following if you didn't select to Launch MySql
Automatically
mysqld-nt --install
net start mysql5
Open the httpd.conf (d:\apache2\conf) file into Notepad. You will need to change some
entries as below:-
ServerRoot "d:/Apache2"
Listen 80
DocumentRoot "d:/Apache2/htdocs"
<Directory "d:/Apache2/htdocs">
<Directory "d:/Apache2/cgi-bin">
Then add the following lines to the END of the conf file.
NB. A BIZARRE SITUATION HAS ARISEN WITH THESE LATEST VERSIONS OF THE WAMP SOFTWARE, WHERE MYSQL
WON'T LOAD ON SOME MACHINES. THE SOLUTION HAS BEEN TO COMMENT OUT THE PHPINIDIR LINE.
D:\Apache2\bin\ApacheMonitor.exe
D:\Apache2\conf\httpd.conf
With this version of Apache, you will need to download and install the Microsoft C++
Redistributable SP1 from Apache Lounge:
http://www.apachelounge.com/download/vcredist_x86-sp1.exe
z in the Variable Name section, find the entry for PATH and add the following to the end
of the line:-
; d:\php520
z Restart Windows
d: (enter)
cd apache2\bin (enter)
Create a text file in notepad with the following, and then save it in your htdocs folder as
index.php:-
<?php
phpinfo()
?>
Then open your web-browser and type in the address bar http://localhost (if using
a port other than port 80 you will need to type http://localhost:port replacing the
word port with the appropriate number.
If all has gone well, you should then get a page similar to this.....
In order to setup the apache server to accept connections via a secure SSL connection
there are 4 things that need to be carried out:-
4: Create an Self Signed Certificate to use for testing. This can be left in place
permanently if you wish, or you can purchase one from a trusted source.
d:/Apache2/htdocs/80
d:/Apache2/htdocs/443
d:/Apache2/conf/ssl
Now let's address the 3 points relating to the HTTPD.CONF file. Open the file into
NOTEPAD and then:-
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.domain.tld
ServerAlias domain.tld *.domain.tld
DocumentRoot "d:/Apache2/htdocs/80"
</VirtualHost>
<VirtualHost *:443>
ServerName www.domain.tld
DocumentRoot "d:/Apache2/htdocs/443"
SSLEngine On
SSLCertificateFile conf/ssl/domain.crt
SSLCertificateKeyFile conf/ssl/domain.key
</VirtualHost>
4: To create the certificate and key, copy the file openssl.cnf from d:/Apache2/conf/
to a new directory c:\openssl\ssl. Now open a DOS window and change the directory
to d:/apache2/bin folder.
You will then be asked to enter the following information (I have added examples in
black capitals):-
Now enter the passphrase (ABRACADABRA) you gave in the previous command.
openssl x509 -in domain.csr -out domain.crt -req -signkey domain.key -days
365 (enter)
Now copy the files to the domain.key and domain.crt from the d:/Apache2/bin folder
to the d:/Apache2/conf/ssl folder
Restart your apache server. Any files that you had in the root of d:/Apache2/htdocs
which were used to test the basic installation of apache, must now be moved into the 80
folder, as this is now the root of the unsecured web-pages. Any pages that are to be
treated as secure must be now stored in the 443 folder.
If you wish to use the domain's mentioned in this article for testing purposes, it will be
necessary to add an entry into the HOSTS file (which can be found in the
c:\windows\system32\drivers\etc\ folder) just add the following text to the end of
the file:-
172.19.0.16 www.domain.tld
remember to substitute 172.19.0.16 with the actual IP address of the PC you are using
for hosting.
Since the initial install, I have added support for icons, designed my own custom error
pages, setup several virtual hosts. I will detail these below:-
Icons
add the following line into your httpd.conf file:-
Include conf/icons.conf
Click icons.conf to download my conf file. You can modify this to suit your own
applications. I also created all new icons based on the actual icons that the files are
associated with.
Virtual Hosts
I am now hosting several websites on our server using the Virtual Hosts facility within
Apache. Add the following line to your httpd.conf file:-
Include conf/vhosts.conf
A problem arose (which is common to all SSL modules) in that the secured domain
(https://www.domain1.co.uk) works fine - but if i were to type
https://www.domain2.co.uk this would automatically serve the files for domain1 - even
though I had specifically set the domains in the VirtualHost configurations!!
After much googling (unsuccessfully) Tom Donovan (from the ApacheLounge Forums)
came up with a solution for me using the RewriteEngine command. Below is the full
entry for the SSL Virtual Host:-
<VirtualHost *:443>
ServerName www.domain10.co.uk
ServerAlias *.domain10.co.uk domain10.co.uk
DocumentRoot "d:/Apache2/htdocs/443"
SSLEngine On
SSLCertificateFile conf/ssl/domain10.crt
SSLCertificateKeyFile conf/ssl/domain10.key
Basically, what this command does is looks at 2 conditions which must both be fullfilled
for the rule to be executed. So, if HTTPS is used, and the domain entered does NOT
equaly www.domain10.co.uk then command line is re-written with http:// instead. This
doesn't stop the warning that the certificate doesn't match the website from popping up,
but in my case, I can live with that!
I wanted to create some new customer error pages, and also to email me about any 404
pages or documents that aren't found, so I can then investigate.
Include conf/error.conf
<Directory "d:/Apache2/error">
AllowOverride None
Options IncludesNoExec
AddOutputFilter Includes html
AddHandler type-map var
Order allow,deny
Allow from all
LanguagePriority en
So far I have only created the 404 error page, but intend to do the others soon. The
contents of the 404 page are as follows:-
<html>
<head>
<title>Error 404 - Document Not Found</title>
</head>
<body>
<font face="verdana, helvetica, arial" size=2>
<font size=1>
<?php
// get environment variables from user
$ip = gethostbyname(@$REMOTE_ADDR);
$netbios = gethostbyaddr($ip);
$ip_addr = getenv("REMOTE_ADDR");
$agent = getenv("http_user_agent");
$name = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$domain = getenv("HTTP_HOST");
$url = getenv("SCRIPT_NAME");
$hostinfo = getenv("SERVER_SOFTWARE");
$user = getenv("HTTP_USER_AGENT");
$from = getenv("HTTP_REFERER");
$time = getenv($_SERVER['REQUEST_TIME']);
echo '<br>';
$strFrom = "sentfrom@domain1.com";
ini_set("SMTP", "post.demon.co.uk");
ini_set("smtp_port", "25");
?>
</body>
</html>
Domain: www.domain1.co.uk
Page: /error/404.php