Return to the main page
Page: 1 2 3 4 5
Double-click in the .MSI file to launch the installation of Apache (Windows 98/Me users may need to install previously the MS Windows Installer). After accepting the license, you'll be prompted for some information: Network domain, Server name and Administrator's email. Since this will be a test server, you can enter whatever you want, but I recommend using your computer network name as server and domain, since this allows accessing the server from other computers in the local network by name instead of by IP number only. Then enter a dummy email direction like "admin@networkname" (we don't need that feature). Regarding the options of the bottom, use the recommended option even if you want to start the server manually (we'll see how to change this later). Windows 98/Me users must select the second option since that versions of Windows doesn't support system services.
Then choose Custom install and remove Build Headers and Libraries, since they are needed only for developing server extensions. You can remove the Apache Documentation if you don't need it. Also, you can change here the installation folder.
Press Next for starting the installation. If all goes well, the Apache service will be started and you'll notice a new icon in your system tray: the Apache Service Monitor. This is a handy tool for managing the Apache service: you can start, stop and restart the service from here.
Note for Windows 98/Me users: You need to use the shortcut Start Apache in Console for starting the server. To close the server, press Ctrl+C on the Apache console window.
At this point, if you have running a firewall in your computer (if not, you really should) you probably will get a notification about letting "Apache HTTP Server" or "Apache.exe" run as a server. My recommendations are:
Now if you open "http://localhost/" in your browser you should get the welcome page of Apache.
Now let's see how you can configure some basic server options to suit your needs.
Most of the Apache configuration is stored in the httpd.conf file located inside the "conf" subfolder of the Apache installation folder. There is also another file, httpd.default.conf, that contains the default configuration of the server (very useful if you mess something in the configuration and the server stops working).
By default, the Apache uses as the server root the "htdocs" folder located inside its installation folder. This is the folder in which you need to put the files that are going to be served by Apache. If you want to use another one, locate in httpd.conf the DocumentRoot option and put the folder that you want to use as server's root (surrounded by double quotes). Then move a few lines below until you find the comment that reads "This [the following line] should be changed to whatever you set DocumentRoot to", and follow its advice. For example, if you want to change the server root to "D:\Web server" you have to use the following configuration lines:
DocumentRoot "D:/Web server"
and several lines below:
<Directory "D:/Web server">
Note that in the Windows version of Apache you can use slashes or backslashes indistinctly for path names, it would work the same (I use slashes since it's the usual way).
Finally, restart the server to apply the changes. The next time you access to "http://localhost/" you should see listed the contents of new root folder. Here you can see two captures of the server root of one of my test machines, one from the same machine in which the server is installed, and the other from another machine in the same local network:
Apache uses a series of modules to extend the server capabilities (like mod_ssl for adding support to secure connections or mod_rewrite for URL rewriting). By default, not all the modules are loaded. If you need to activate some of them, look for the modules section of httpd.conf (the one that contains a lot of LoadModule lines). If the line describing the module is commented (i.e. it begins with a "#") that module is not active, and you need to remove the comment character to activate it.
For example, if you want to activate the mod_rewrite module, first you need to find the line describing that module:
#LoadModule rewrite_module modules/mod_rewrite.so
and then remove the "#" to activate it:
LoadModule rewrite_module modules/mod_rewrite.so
After this, restart the server to apply the configuration changes.
and change it to:
AllowOverride AllNote that there is another line with the same text "inside" of a <directory> tag. You have to change the line that is not surrounded by other configuration parameters.
Port 80 already in use. If you receive an error message like this:
<OS 10048>Only one usage of each socket address <protocol/network address/port> is normally permitted. : make_sock: could not bind address 0.0.0.0.:80 no listening sockets available, shutting down
Unable to open logs
Note the errors or messages above, and press <ESC> key to ext. ...
[Sat Oct 09 14;22:48 2004] [error] <OS2>The system cannot find the specific
ed. : no installed service named "Apache2".
Note the errors or messages above, and press <ESC> key to exit
it means that there is another server already running on port 80 (the default port used for HTTP connections). Only one application can listen for connections in a given port at the same time, so if you have active another server (like IIS), Apache can't use that port.
The solution for this is as simple as close or disable the other program when you need to use Apache. If you don't know what program is using that port, you can use an utility like Active Ports or TCPView for getting the list of programs associated to any active port in the system.
If for some reason you need to maintain the other program running in the port 80, you can change the port number in which Apache will listen for connections. You can use any port number that is not already used by another program between 1024 and 65535 (e.g. 8080, 8000, 10080, 12345...). For doing that open the httpd.conf file and find the following lines (they are located in different parts of the file):
and then replace the 80 with the port number you want to use:
After this you can access to the server using the host name plus the port number separated by a colon, like in this examples:
Return to the main page