-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Sample Apache Setup for Windows
Category:Help Category:Help::ApacheConfig
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 this is not something that you would put on a production server! 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...
First I downloaded Apache, MySQL (you want the lighter Essentials package) and PHP.
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;
http://blog.stardust
http://forum.stardust
http://gallery.stardust
These are made by the usage of Apache's vhosts 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
127.0.0.1 mynew.site
then you add it to the Apache vhost configuration file (httpd-vhosts.conf), like this.
<VirtualHost *:80>
ServerName mynew.site
DocumentRoot d:/www/php/mynew.site
ErrorLog logs/mynew-error_log
</VirtualHost>
another then... reload apache and you're set to use http://mynew.host 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 :-)
#----- 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 -------------------------------------------------------
<Directory />
Options Indexes FollowSymLinks
AllowOverride ALL
Order allow,deny
Allow from all
</Directory>
<IfModule dir_module>
DirectoryIndex index.php dispatch.fcgi index.html
</IfModule>
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
</FilesMatch>
#----- Logging Configuration ------------------------------------------------
ErrorLog logs/error.log
LogLevel warn
<IfModule log_config_module>
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
</IfModule>
#----- Module Configurations ------------------------------------------------
DefaultType text/plain
<IfModule mime_module>
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
</IfModule>
<IfModule php5>
PHPIniDir "d:/dev/php"
</IfModule>
<IfModule cgid>
AddHandler fastcgi-script .fcgi
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "D:/dev/Apache/cgi-bin/"
</IfModule>
#----- Extra Configurations -------------------------------------------------
Include conf/extra/httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
nServerName stardust
DocumentRoot d:/www/php
ErrorLog logs/stardust-error_log
</VirtualHost>
<VirtualHost *:80>
ServerName blog.stardust
DocumentRoot d:/www/php/blog
ErrorLog logs/blog.stardust-error_log
</VirtualHost>
127.0.0.1 stardust
127.0.0.1 blog.stardust
127.0.0.1 localhost
This is the two things I've altered.
doc_root = "c:\dev\www"
extension_dir = "d:\dev\php\ext"