Setting up your own server
- CommonStray
- Forum Assassin
- Posts: 1215
- Joined: 20 Aug 2005, 16:00
- 19
Setting up your own server
Whats up everyone Circuitbomb here, and well after a long interesting night of setting up my own server here on my home network, ive decided to tell you how i did it (on a Windows machine NT/2000/ME/XP, so that you can do it as well. so lets get started.
mind you ive been up all night so if this seems choppy i apologize...
Overview:
What we are going to do is set up a webserver, that, will run php, mysql, perl and cgi scripts.
First and foremost you want the webserver, the one i used and that i recommend is Apache HTTP Web Server
www.apache.org - I downloaded the win32 MSI package
When you goto install the server youll be asked for some info
Network Domain:
Server Name: l
Admin Email:
Enter as follows:
localhost
127.0.0.1
your e-mail address
Once installed, open the Apache Monitor and make sure its running
(run it as a service during install)
goto start->Apache HTTP Server-> Configure Apache Web Server->Edit Configuration File
this opens notepad and your config file
Find DocumentRoot and enter in the dir that you will be keeping your files in
like this E:/dir (use the backlash)
scroll down and Find <Directory =
and enter in the same dir that you used for your DocumentRoot
put an index.html page in that directory
goto Apache Monitor and restart
test it by going to http://localhost or http://127.0.0.1 in your web-browser
if you see your index page good its working
-------now to install CGI/PERL-----------
Get ActivePERL from www.activestate.com
Install ActivePERL to a directory named e:\usr (it dont HAVE to be that name but its recommended)
have the "add Perl to the PATH environment variable" checked
and "Create Perl file extension association" checked
open your Apache Config File like above
Find Options Indexes FollowSymLinks
add ExecCGI to the end of it
so it looks like Options Indexes FollowSymLinks ExecCGI
Next, Find ScriptAlias /cgi-bin/ "E:/Apache2/cgi-bin/"
hash it out by adding a # in front of that line
Next, Find #AddHandler cgi-script .cgi
Remove the hash and .pl to the end
like this : AddHandler cgi-script .cgi .pl
Test CGI/PERL: open a new notepad document and paste in
#!e:/usr/bin/perl
print "Content-type:text/html\n\n";
print "hello world";
where the top line is where perl.exe is installed
save as either test.cgi or test.pl
put into your DocumentRoot Directory
goto Apache Monitor and restart
goto http://127.0.0.1/test.cgi or http://localhost/test.pl
whichever you named the filetype
If you see the words Hello world, good its working
--------installing PHP------------------
goto www.php.net and get the zipped version of PHP that is Win32/Apache compliant
unzip and goto the directory you unzipped it to and rename php.ini-dist it to php.ini
open php.ini
Find doc_root = "e:\public_html" and change it to whatever your DocumentRoot is
Find extension_dir = "./"
change it to the ext folder that unzipped with php
kinda like E:/php/ext
Now open you Apache Config File again and paste
LoadModule php5_module "e:/php/php5apache2.dll"
AddType application/x-httpd-php .php
PHPIniDir "e:/php"
in the beginning or end of the config file, make sure to change the paths to the relevant ones where you unzipped php
save and goto Apache Monitor and reset
open up a new notepad put in
<?php
phpinfo();
?>
save as test.php in your DocumentRoot
goto it in your webbrowser
if you see a bunch of stuff, its working
---------Installing MySQL --------
goto http://dev.mysql.com/downloads/mysql/4.1.html and download the version for Windows
install the MSI and choose these
Typical Setup
Skip Sign-Up
make sure "Configure the MySQL Server now" is checked
Detailed Configuration"
Developer Machine"
Multifunctional Database"
InnoDB Tablespace Settings" - leave the same
Decision Support (DSS)/OLAP"
make sure "Enable TCP/IP Networking" is checked and leave the port number at 3306
Standard Character Set
check "Install As Windows Service"
"Include Bin Directory in Windows PATH" checked
enter root password
dont let remote access
hit "execute" and it'll install and set up.
Copy the libmysql.dll from your php directory to your system folder(usually system or system32)
open your php.ini file
Find ;extension=php_mysql.dll and remove the semi-colon
goto Apache Monitor and restart
to test yor MySQL by php
make a new notepad file and paste
<?php
// hostname or ip of server (for local testing, localhost should work)
$dbServer='localhost';
// username and password to log onto db server (what you entered in Step 4)
$dbUser='root';
$dbPass='';
// name of database (what you created in step 4)
$dbName='test';
$link = mysql_connect("$dbServer", "$dbUser", "$dbPass") or die("Could not connect");
print "Connected successfully<br>";
mysql_select_db("$dbName") or die("Could not select database");
print "Database selected successfully<br>";
// close connection
mysql_close($link);
?>
save it as sqltest.php in yor documentroot folder
load it in your browser if you see it you know its working
later on when ive had some rest ill tell you how to set phpMyAdmin so you can better have control over your MySQL databases till then
zzzzzzzzzzzzzzzzz
mind you ive been up all night so if this seems choppy i apologize...
Overview:
What we are going to do is set up a webserver, that, will run php, mysql, perl and cgi scripts.
First and foremost you want the webserver, the one i used and that i recommend is Apache HTTP Web Server
www.apache.org - I downloaded the win32 MSI package
When you goto install the server youll be asked for some info
Network Domain:
Server Name: l
Admin Email:
Enter as follows:
localhost
127.0.0.1
your e-mail address
Once installed, open the Apache Monitor and make sure its running
(run it as a service during install)
goto start->Apache HTTP Server-> Configure Apache Web Server->Edit Configuration File
this opens notepad and your config file
Find DocumentRoot and enter in the dir that you will be keeping your files in
like this E:/dir (use the backlash)
scroll down and Find <Directory =
and enter in the same dir that you used for your DocumentRoot
put an index.html page in that directory
goto Apache Monitor and restart
test it by going to http://localhost or http://127.0.0.1 in your web-browser
if you see your index page good its working
-------now to install CGI/PERL-----------
Get ActivePERL from www.activestate.com
Install ActivePERL to a directory named e:\usr (it dont HAVE to be that name but its recommended)
have the "add Perl to the PATH environment variable" checked
and "Create Perl file extension association" checked
open your Apache Config File like above
Find Options Indexes FollowSymLinks
add ExecCGI to the end of it
so it looks like Options Indexes FollowSymLinks ExecCGI
Next, Find ScriptAlias /cgi-bin/ "E:/Apache2/cgi-bin/"
hash it out by adding a # in front of that line
Next, Find #AddHandler cgi-script .cgi
Remove the hash and .pl to the end
like this : AddHandler cgi-script .cgi .pl
Test CGI/PERL: open a new notepad document and paste in
#!e:/usr/bin/perl
print "Content-type:text/html\n\n";
print "hello world";
where the top line is where perl.exe is installed
save as either test.cgi or test.pl
put into your DocumentRoot Directory
goto Apache Monitor and restart
goto http://127.0.0.1/test.cgi or http://localhost/test.pl
whichever you named the filetype
If you see the words Hello world, good its working
--------installing PHP------------------
goto www.php.net and get the zipped version of PHP that is Win32/Apache compliant
unzip and goto the directory you unzipped it to and rename php.ini-dist it to php.ini
open php.ini
Find doc_root = "e:\public_html" and change it to whatever your DocumentRoot is
Find extension_dir = "./"
change it to the ext folder that unzipped with php
kinda like E:/php/ext
Now open you Apache Config File again and paste
LoadModule php5_module "e:/php/php5apache2.dll"
AddType application/x-httpd-php .php
PHPIniDir "e:/php"
in the beginning or end of the config file, make sure to change the paths to the relevant ones where you unzipped php
save and goto Apache Monitor and reset
open up a new notepad put in
<?php
phpinfo();
?>
save as test.php in your DocumentRoot
goto it in your webbrowser
if you see a bunch of stuff, its working
---------Installing MySQL --------
goto http://dev.mysql.com/downloads/mysql/4.1.html and download the version for Windows
install the MSI and choose these
Typical Setup
Skip Sign-Up
make sure "Configure the MySQL Server now" is checked
Detailed Configuration"
Developer Machine"
Multifunctional Database"
InnoDB Tablespace Settings" - leave the same
Decision Support (DSS)/OLAP"
make sure "Enable TCP/IP Networking" is checked and leave the port number at 3306
Standard Character Set
check "Install As Windows Service"
"Include Bin Directory in Windows PATH" checked
enter root password
dont let remote access
hit "execute" and it'll install and set up.
Copy the libmysql.dll from your php directory to your system folder(usually system or system32)
open your php.ini file
Find ;extension=php_mysql.dll and remove the semi-colon
goto Apache Monitor and restart
to test yor MySQL by php
make a new notepad file and paste
<?php
// hostname or ip of server (for local testing, localhost should work)
$dbServer='localhost';
// username and password to log onto db server (what you entered in Step 4)
$dbUser='root';
$dbPass='';
// name of database (what you created in step 4)
$dbName='test';
$link = mysql_connect("$dbServer", "$dbUser", "$dbPass") or die("Could not connect");
print "Connected successfully<br>";
mysql_select_db("$dbName") or die("Could not select database");
print "Database selected successfully<br>";
// close connection
mysql_close($link);
?>
save it as sqltest.php in yor documentroot folder
load it in your browser if you see it you know its working
later on when ive had some rest ill tell you how to set phpMyAdmin so you can better have control over your MySQL databases till then
zzzzzzzzzzzzzzzzz
- bad_brain
- Site Owner
- Posts: 11638
- Joined: 06 Apr 2005, 16:00
- 19
- Location: In your eye floaters.
- Contact:
Sure, Merchant...
PHP is great for dynamic websites and database interaction, but of course a HTML-document works properly too. you only need Apache (or any other server, but Apache is the best anyway ) for this job. all you have to do is to place the .html or .htm-file(s) in the document root-folder.
oh,and HTML is no scripting language btw, it´s a markup language...
great post btw, Circuit...
PHP is great for dynamic websites and database interaction, but of course a HTML-document works properly too. you only need Apache (or any other server, but Apache is the best anyway ) for this job. all you have to do is to place the .html or .htm-file(s) in the document root-folder.
oh,and HTML is no scripting language btw, it´s a markup language...
great post btw, Circuit...
- CommonStray
- Forum Assassin
- Posts: 1215
- Joined: 20 Aug 2005, 16:00
- 19
- CommonStray
- Forum Assassin
- Posts: 1215
- Joined: 20 Aug 2005, 16:00
- 19
well ill tell you i havnt done this in Linux yet (bad_brain can you pick up on this?) anyways if you want to do thism its esy enough to goto each of the websites for each thing that ive posted (apache, php, mysql etc...) and download the linux compatible versions, each comes with installation doc's so it may not be TO hard
- bad_brain
- Site Owner
- Posts: 11638
- Joined: 06 Apr 2005, 16:00
- 19
- Location: In your eye floaters.
- Contact:
bad_brain´s little setting-up-Apache-as-a-proxy-tut
-create a directory named proxy in home
-create 3 subdirectories in proxy named:
-cache
-proxy
-inter //not neccessary, for testing
-create a file named run in /home/proxy/proxy:
httpd -d/home/proxy/proxy -f/home/proxy/proxy/conf/httpd.conf
don´t forget to give this file the appropriate rights with chmod.
-create subdirectories in both proxy and inter:
-conf
-htdocs
-logs
-now copy httpd.conf into /home/proxy/proxy/conf
-now edit httpd.conf
------// for testing, not neccessary--------------------
-k,now we setup Apache a 2nd time which acts as the internet to see how it works, copy httpd.conf (the original one) to /home/inter/conf and edit it:
-copy the run-file to inter
-chmod run
-place a index.html into inter/htdocs
-now stop Apache and start the proxy and the "internet" with the run-files.
-change your proxy-settings in the browser, you should be able to view the html-document you´ve placed in htdocs.
to make sure the proxy works just enter an unknown adress and you should get an proxy-error...
-create a directory named proxy in home
-create 3 subdirectories in proxy named:
-cache
-proxy
-inter //not neccessary, for testing
-create a file named run in /home/proxy/proxy:
httpd -d/home/proxy/proxy -f/home/proxy/proxy/conf/httpd.conf
don´t forget to give this file the appropriate rights with chmod.
-create subdirectories in both proxy and inter:
-conf
-htdocs
-logs
-now copy httpd.conf into /home/proxy/proxy/conf
-now edit httpd.conf
Code: Select all
User >username<
Group >groupname<
Servername >name or IP<
Port >Port your Proxy should run on<
ProxyRequests on
CacheRoot /home/proxy/cache
CacheSize >Size of Cache in kb<
ServerRoot /home/proxy/proxy
------// for testing, not neccessary--------------------
-k,now we setup Apache a 2nd time which acts as the internet to see how it works, copy httpd.conf (the original one) to /home/inter/conf and edit it:
Code: Select all
User >username<
Group >groupname<
Servername >Ip or name<
Listen >serverIP<:80
DocumentRoot /home/proxy/inter/htdocs
-chmod run
-place a index.html into inter/htdocs
-now stop Apache and start the proxy and the "internet" with the run-files.
-change your proxy-settings in the browser, you should be able to view the html-document you´ve placed in htdocs.
to make sure the proxy works just enter an unknown adress and you should get an proxy-error...
Here's a cool little app I've used before that combines quite a few things in one install...
http://www.apachefriends.org/en/xampp-windows.html
PHP, mySQL, Apache, CGI, Mercury Mail, FileZilla...and has add-ons for Perl, Python and Tomcat. It's pretty easy to install and setup...and their website has pretty good tutorials with pics for help with setup.
http://www.apachefriends.org/en/xampp-windows.html
PHP, mySQL, Apache, CGI, Mercury Mail, FileZilla...and has add-ons for Perl, Python and Tomcat. It's pretty easy to install and setup...and their website has pretty good tutorials with pics for help with setup.
- CommonStray
- Forum Assassin
- Posts: 1215
- Joined: 20 Aug 2005, 16:00
- 19
- CommonStray
- Forum Assassin
- Posts: 1215
- Joined: 20 Aug 2005, 16:00
- 19