Localhost

xampp.png

This is the first part of The Making of samisdat 2.0.
Actually it is part zero, because i start really nearly with zero and install a local apacheserver with MySQL and PHP.

A local host is extremely useful, because i can test everything on my own computer and upload it, when I’m sure it works.
In order to make it even more handy, I add a virtual host.

A vHost acts like an real server: It has has its own DocRoot and domain name. Afterwards this saves my much work, because i only have to replace .txp by .org and change some paths.

Screencast

The screencast shows the complete installation and configuration of the server. And the installation shown is really the one I will use in the further Redesign. That will be one principle of the complete Redesign: I make a step and describe it as much as exactly as possible. In the sense the Live Redesign is really live.

The screencast is made by Wink. The English version is without audio, because I have only a German mic.

In addition to the screencast, you can read the whole step on the following pages.

XAMPP

I use XAMPP by Apache Friends as local server.
This one contains everything what I need to run Textpattern and the installer is doing nearly the complete configuration.

XAMPP is the simplest way to get a local server.
Automatic installation and while Windows ignores access rights (755, 777 etc.) I don’t have to care about them.

Even someone who never get in touch with a local host can install XAMPP within half an hour.

Install

First of all I download and start the XAMPP Installer.

I can choose where to install it and because i want to know what I put where, i choose:
C:\localhost

The installer copies all files and take care for the configuration of the server.

Testing

Straight after the install is finished, I can see my local server:
Just start the server, open a browser and point to localhost oder 127.0.0.1.

Configuration

Textpattern uses mod_rewrite for the clean URLs and I have to active the module.

I open the file C:\localhost\xampp\apache\conf\httpd.conf and uncomment the line 116:

#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
HL#LoadModule rewrite_module modules/mod_rewrite.soHL
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule speling_module modules/mod_speling.so

All other configurations have been done by the installer.

Virtual hosts are very usefull: I can host several projects on a local server and define a vHost for each project.
Instead of http://localhost I can use a different domain and a different DocRoot. I use samisdat.txp testing samisdat.

While using vHost I don’t have to use sub dirs (f.e. http://localhost/samisdat) on my local server and afterwards uploading is much more easy: Just replacing .txp by .org and changing the paths.

Set up

Virtual Host are defined in
C:\localhost\xampp\apache\conf\extra\httpd-vhosts.conf

First of all I have to tell the server which IP should be attented:

HLNameVirtualHost 127.0.0.1HL

The file httpd-vhosts.conf contains a template for vHost:

#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
HL#LoadModule rewrite_module modules/mod_rewrite.soHL
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule speling_module modules/mod_speling.so

I don’t need most of these entries. I define only a DocRoot and a server name. First defining localhost, because I don’t want to break that one:

HLNameVirtualHost 127.0.0.1HL

Now i set up samisdat.txp

##<VirtualHost *:80>
## ServerAdmin webmaster@dummy-host.example.com
## DocumentRoot /www/docs/dummy-host.example.com
## ServerName dummy-host.example.com
## ServerAlias www.dummy-host.example.com
## ErrorLog @rel_logfiledir@/dummy-host.example.com-error_log
## CustomLog @rel_logfiledir@/dummy-host.example.com-access_log common
##</VirtualHost>

By the way samisdat.com would be also possible. But I always use TLD which are not in use in the real internet and which I can remember: For example .txp for Textpattern projects, .pc for my desktop and .not for a local server on my notebook.

hosts

I have defined the vHost samisdat.txp, but before I can acess thisone, I have change the file hosts.

This file is something like my very own DNS server. It connects IPs with hostnames.

While operating with Windows XP I find the file hosts at
C:\WINDOWS\system32\drivers\etc.
By default it should contain only one entry:

<VirtualHost 127.0.0.1>
DocumentRoot C:/localhost/xampp/htdocs
ServerName localhost
</VirtualHost>

For every vHost I add another:

<VirtualHost 127.0.0.1>
DocumentRoot C:/localhost/xampp/htdocs/samisdat
ServerName samisdat.txp
</VirtualHost>

Browser Preferences

Now I have to tell my browser, that he should use the hosts file instead of DNS Server.

This preference should be (I don’t know exactly, because I’m using a German Firefox):
Extras > Preferences -> Advanced> Network.
There is an entry called No Proxy, it should contain:

127.0.0.1 localhost

I add .txp:

127.0.0.1 localhost
HL127.0.0.1 samisdat.txpHL

.txp is enough and I don’t have to change this pref, if I add another .txp vHost.

In every browser this preference is named a little different and every browser separates the servernames in a other manner:
Firefox seperates by , while IE by ; and Opera wants a new line for every entry.

Last but not least I have to create the dir /samisdat.
I defined that one as DocRoot fpr samisdat.txp and if that one isn’t existing, I’ll get errors starting the server.
So creating
C:/localhost/xampp/htdocs/samisdat.

Thats it. Restart the server and as a little test I create
C:/localhost/xampp/htdocs/samisdat/index.php:

127.0.0.1, localhost

After pointing my browser to http://samisdat.txp, I see my very first PHP script locally served:

127.0.0.1, localhost, .txp

That was the first part of The Making of samisdat 2.0.
I now have a local server with PHP and MySQL and a virtual host on it.

If You liked this first part or if you questions or remarks: Please leave a comment.

I hope I see you at

The next step

I have done everything to install Textpattern 4.0.4 in the second part.
This one will also contain the first plugins: bas_toc which paginates articles and deliveres the table of contens and bas_code which displays all the code examples.

Links

If you want to read on:

Wikipedia:

<?php
echo '<pre>';
var_dump($_SERVER['HTTP_HOST']);
echo '</pre>';
?>

Comments

brittany spears naked http://www.geocities.com/teendtiwoman/sqqpa/brittany-spears-naked.htm
[url=http://www.geocities.com/teenavcteeny/dfqnq/bbw-free-porn-trailer.htm]bbw free porn trailer[/url]
&lt;a href=&quot;http://www.geocities.com/girlsnmehpretty/byqvd/sexy-lingerie-movie.htm&quot;&gt;sexy lingerie movie&lt;/a&gt;

&lt;a href=&quot;http://www.geocities.com/analptsweet/jhpno/secretary-and-boss-sex.htm&quot;&gt;secretary and boss sex&lt;/a&gt;

Write a new comment