-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Sample Apache Setup for Windows
Category:Help Category:Help::ApacheConfig [h3]My development setup[/h3] This is how I've setup up my testing suite of Apache, MySQL and PHP (and yes, I don't like prefabricated bundles with a lot of third party scripts/plugins/apps included). I must stress that [strong]this is not something that you would put on a production server![/strong] You should also consider this as a stub, not a full blow fool-proof setup walk through - but you should get some hints here.
This document assumes a couple of things, like paths etc. Installation directories: d:\dev\apache d:\dev\mysql d:\dev\php
Development directories: (Since I use more than PHP I have it sorted this way) d:\www\php* <- this is where you'd store your CI apps d:\www...
[h3]Download and Install[/h3] First I downloaded [url=http://httpd.apache.org/download.cgi]Apache[/url], [url=http://mysql.com/downloads/mysql/5.0.html]MySQL[/url] (you want the lighter Essentials package) and [url=http://www.php.net/downloads.php]PHP[/url].
There's alot of options that you can make to lower the resources used by the install, but I won't venture into that - there's book about it, thick books...
The nice trick with my setup is that by using vhosts (virtual hosts) I have an easily accessible setup for my different projects (not necessarily related to CI), right now I have these cool urls; [code]http://blog.stardust http://forum.stardust http://gallery.stardust[/code] These are made by the usage of Apache's [url=http://httpd.apache.org/docs/2.2/vhosts/]vhosts[/url] and the windows hosts (C:\WINDOWS\system32\drivers\etc\hosts) file you can make nice URL's, but that's not the point - really, it makes it alot easier to separate projects and expand/incorporate them.
To make a new "host", you first add it to the hosts file like this [code]127.0.0.1 mynew.site[/code] then you add it to the Apache vhost configuration file (httpd-vhosts.conf), like this. [code] <VirtualHost *:80> ServerName mynew.site DocumentRoot d:/www/php/[strong]mynew.site[/strong] ErrorLog logs/mynew-error_log [/code] another then... reload apache and you're set to use [url=http://mynew.host[/url] Code Igniter projects.
This may not make alot of sense on why to use a setup like this, but when you have 10-15 projects/forks/tests running on your can it makes life easier...
Below are my configuration settings... I hope this is of use :-)
[h3]My httpd.conf[/h3] [code] #----- Base Setup ----------------------------------------------------------- ServerRoot "d:/dev/apache" Listen *:80
ThreadsPerChild 50 MaxRequestsPerChild 0
ServerAdmin admin@stardust ServerName stardust DocumentRoot "D:/www/php"
EnableSendfile Off EnableMMAP Off Win32DisableAcceptEx
#----- Module Loading ------------------------------------------------------- LoadModule authn_default_module modules/mod_authn_default.so LoadModule authz_host_module modules/mod_authz_host.so LoadModule dir_module modules/mod_dir.so LoadModule mime_module modules/mod_mime.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule setenvif_module modules/mod_setenvif.so LoadModule php5_module d:/dev/php/php5apache2.dll
#----- Root Directory ------------------------------------------------------- Options Indexes FollowSymLinks AllowOverride ALL Order allow,deny Allow from all
DirectoryIndex index.php dispatch.fcgi index.html<FilesMatch "^.ht"> Order allow,deny Deny from all
#----- Logging Configuration ------------------------------------------------ ErrorLog logs/error.log LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog logs/access.log common
#----- Module Configurations ------------------------------------------------ DefaultType text/plain TypesConfig conf/mime.types AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType application/x-httpd-php .php AddType application/x-httpd-phps .phps
PHPIniDir "d:/dev/php" AddHandler fastcgi-script .fcgi ScriptAlias /cgi-bin/ "D:/dev/Apache/cgi-bin/"#----- Extra Configurations ------------------------------------------------- Include conf/extra/httpd-vhosts.conf
[/code]
[h3]My httpd-vhosts.conf[/h3] [code] NameVirtualHost *:80
<VirtualHost *:80> nServerName stardust DocumentRoot d:/www/php ErrorLog logs/stardust-error_log
<VirtualHost *:80> ServerName blog.stardust DocumentRoot d:/www/php/blog ErrorLog logs/blog.stardust-error_log [/code]
[h3]My hosts file[/h3] [code] 127.0.0.1 stardust 127.0.0.1 blog.stardust 127.0.0.1 localhost [/code]
[h3]My php.ini[/h3] This is the two things I've altered. [code] doc_root = "c:\dev\www" extension_dir = "d:\dev\php\ext" [/code]