Httpd exe k install

This article is a step by step guide to creating a local web server. It describes how to install the Apache 2.4 web server on a Windows OS platform. Installation testing was performed on Windows Server 2012 R2 for a 64-bit operating system. More details can be found in the documentation

Last updated: 02/26/2021

Before installing Apache, it should be noted that if our OS is Windows, then the package for C ++ must be installed on the system, which can be found at
for 64-bit
and for 32-bit

So, if our OS is Windows, let’s go to the site
, which provides distributions of Apache for Windows:

Загрузка веб-сервера Apache

In subparagraph Apache 2.4 binaries VS16
choose the latest version of the server distribution. On the downloads page, we can
find two versions of the Apache package – for 64-bit systems and for 32-bit ones.

After downloading the package with Apache, unpack the downloaded archive. In it we will find the folder directly with the web server files – the .
Let’s move this directory to drive C so that the full path to the directory is .

Start Apache

Find the file in the unpacked archive

Запуск веб-сервера Apache

This is the server executable. Let’s launch it. We should open the following console:

веб-сервер Apache httpd.exe

While this application is running, we can access the server. To test it, enter the address in a web browser
. The web browser should then display the following page:

it works в веб-сервере Apache

This page symbolizes that our web server is running and we can work with it.

Web server configuration

Now let’s configure the server to connect it with the previously installed PHP interpreter. To do this, find in the web server folder
in directory (i.e. ) file

конфигурация веб-сервера Apache и связь с PHP

Let’s open this file in a text editor. configures the behavior of the web server.
We won’t touch on its descriptions in the same way, but only make minor changes that we need to work with PHP.

First of all let’s connect PHP. To do this, we need to connect the php module designed to work with apache. In particular, in the folder
php we can find the file :

php8apache2_4.dll и веб-сервер Apache и связь с PHP

To connect php, find the end of the module loading block in the file

#LoadModule vhost_alias_module modules/
#LoadModule watchdog_module modules/
#LoadModule xml2enc_module modules/

And at the end of this block add lines

 LoadModule php_module "C:/php/php8apache2_4.dll"
PHPIniDir "C:/php"

Next, we will indicate the place where we will store the sites. To do this, let’s create, for example, a directory on the C drive. Then we will find in the httpd.conf file

 DocumentRoot "${SRVROOT}/htdocs"

The default document repository is “c:/Apache24/htdocs”. Replace this line with the following:

 DocumentRoot "c:/localhost"


Let’s change the paths to the files that will contain information about errors or site visits. To do this, find the string

 ErrorLog "logs/error.log" 

And replace it with

 ErrorLog "c:/localhost/error.log" 

Next, find the string

 CustomLog "logs/access.log" common 

And replace it with

 CustomLog "c:/localhost/access.log" common 

So File error.log
, to which errors are written, and a file access.log
, which includes all
website visit data will be located in the c:/localhost folder.

Then find the line:


And replace it with

 ServerName localhost 

Next, find the block <IfModule mime_module>

 # TypesConfig points to the file containing the list of mappings from
 # filename extension to MIME-type.
 TypesConfig conf/mime.types

And below the line <IfModule mime_module>
add two lines:

 AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

That is, it should turn out:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
 # TypesConfig points to the file containing the list of mappings from
 # filename extension to MIME-type.
 TypesConfig conf/mime.types

In this case, we have added support for files with the extension .php
and .phps

And at the end we will find a block <IfModule dir_module>

 DirectoryIndex index.html


And replace it with the following:

DirectoryIndex index.html index.php


In this case, we define the files that will be executed when accessing the root of the file or directory. That is, in fact, we define the main pages
website: index.html and index.php.

This is the minimum required configuration required to work with PHP.


In this case, we have created a simple script that displays general information about PHP.

Now let’s run the file again and access this script by typing


What happened here? When accessing the site on the local machine, .
Then the name of the resource being accessed is indicated. In this case, the file is used as a resource.
. And since the directory is specified in the httpd.conf file as the web server document repository, it is in this directory that the
the web server will search for the required files.

And since we indicated above when configuring that the file can be used as the main page, we can also refer to
this resource is simple

Thus, now we can create our sites in php.

Installing the web server as a service

If we often work with a web server, including for programming in PHP, then constantly launch the server in this way,
can be tedious. And as an alternative, we can install Apache as a Windows service.
To do this, run the Windows command line as an administrator and install Apache as a service using the command:

 C:\Apache24\bin\httpd.exe -k install 

Установка Apache и PHP

That is, in this case, we write the full path to the httpd.exe file (C:\Apache24\bin\httpd.exe) and then specify the command to install the service -k install

If the installation is successful, the command line will display the message “The Apache2.4 service is successfully installed”. The server will also be tested.

After installing the service, make sure that it is running

Установка Apache и PHP в качестве службы Windows

Как установить сервер Apache?

How do I install a local Apache 2.4 server on a Windows machine?

Using Apache HTTP Server on Microsoft Windows

This document explains how to install, configure and run Apache 2.4 under Microsoft Windows. If you have questions after reviewing the documentation (and any event and error logs), you should refer to the mailing list
maintained by peer users.

This document assumes that you are installing a binary distribution of Apache. If you want to compile Apache yourself (perhaps for development assistance or bug tracking), see Compiling Apache for Microsoft Windows

Operating system requirements

The primary Windows platform to run Apache 2.4 is Windows 2000 or later. Always obtain and install the current service pack to avoid operating system errors.

Versions of Apache HTTP Server later than 2.2 will not run on any operating system prior to Windows 2000.

Download Apache for Windows

The Apache HTTP Server Project itself does not provide binary releases of the software, only source code. Individual committers may provide binary packages for convenience, but this is not a deliverable release.

If you are unable to compile Apache HTTP Server yourself, you can obtain a binary package from the numerous binary distributions available on the Internet.

Popular deployment options for Apache httpd (and optionally PHP and MySQL) on Microsoft Windows include:

Setting up Apache for Windows

Apache is configured using files in the conf subdirectory. These are the same files used to set the Unix version, but there are a few different directives for Apache on Windows. See directive index
for all available directives.

Major differences in Apache for Windows:

  • Since Apache for Windows is multi-threaded, it does not use a separate process for each request, like Apache on Unix. Instead, there are usually only two Apache processes running: a parent process and a child process that handles requests. Inside the child process, each request is handled by a separate thread.
  • Process control directives are also different:

    : Like the Unix directive, this controls how many connections one child process will serve before exiting. However, unlike Unix, the replacement process is not immediately available. Use the default MaxConnectionsPerChild 0 unless you specify how to change the behavior to fix memory leaks in third-party modules or in-process applications.

    Warning. The server configuration file is reread when a new child process is started. If you change httpd.conf, the new child may not start, or you may get unexpected results.

    : This directive is new. It tells the server how many threads it should use. This is the maximum number of connections the server can handle at one time, so make sure this number is high enough for your site if you get a lot of hits. The recommended default value is ThreadsPerChild 150, but this should be adjusted to reflect the highest expected number of concurrent connections to accept.

  • Directives that take filenames as arguments must use Windows filenames instead of Unix ones. However, since Apache can interpret the backslash as a sequence of “escape characters”, you must always use a forward slash in pathnames, not a backslash.
  • While filenames are usually not case sensitive on Windows, URLs are still treated internally as case sensitive before they are mapped to the file system. For example, all directives
    , Alias ​​
    and ProxyPass
    use case-sensitive arguments. For this reason, it is especially important to use the directive
    when trying to restrict access to content in the file system, since this directive applies to any content in the directory, regardless of how it is accessed. If you want to make sure that only lowercase letters are used in the URL, you can use something like:
  • Apache only requires write access to the log directory and any configured cache directory tree. Due to the issue of case-insensitive and short names in 8.3 format, Apache must check all given paths. This means that every directory that Apache evaluates, from the root of the drive to the leaf of the directory, must have permissions to read and view the directory. If Apache2.4 is installed in C:\Program Files, then Apache should be able to see the root directory, Program Files, and Apache2.4.
  • Apache for Windows contains the ability to load modules at runtime, without recompiling the server. If Apache is compiled normally, it will install some additional modules in the \Apache2.4\modules directory. To activate certain modules, you must use the LoadModule directive. For example, to enable the status module, use the following (in addition to the status enable directives in access.conf):
  • LoadModule status_module "modules/"

    Information about creating downloadable modules
    also available.

  • Apache can also load ISAPI (Internet Server Application Programming Interface) extensions, such as those used by Microsoft IIS and other Windows servers. More details available
    . Note that Apache cannot load ISAPI filters, and ISAPI handlers with some Microsoft feature extensions will not work.
  • When running CGI scripts, the method used by Apache to find the script interpreter is configured using the directive ScriptInterpreterSource
  • Since it is often difficult to manage files with names like .htaccess on Windows, it may be useful to change the name of this configuration file on a per-directory basis using the directive
  • Any errors during Apache startup are logged in the Windows event log when running under Windows NT. This mechanism acts as a fallback for situations where Apache is not yet ready to use the error.log file. You can view the Windows Application Event Log using the Event Viewer, for example, Start – Settings – Control Panel – Administrative Tools – Event Viewer.
:/>  Как восстановить календарь на андроид

Running Apache as a Service

Apache comes with a utility called Apache Service Monitor. With it, you can see and manage the status of all installed Apache services on any machine on your network. In order to be able to manage the Apache service using the monitor, you first need to install the service (either automatically via install or manually).

You can install Apache as a Windows NT service as follows from the command line in the Apache bin subdirectory:

httpd.exe -k install

If you need to specify the name of the service you want to install, use the following command. You must do this if you have several different Apache service installations on your machine. If you specify a name during installation, you must also specify it during any other -k operation

httpd.exe -k install -n "MyServiceName"

If you need to have specifically named configuration files for different services, you should use this:

httpd.exe -k install -n "MyServiceName" -f "c:\files\my.conf"

If you use the first command without any special options other than -k install
, the service will be named Apache2.4 and the configuration is expected to be conf\ httpd.conf

Removing the Apache service is easy. Just use:

httpd.exe -k uninstall

The specific Apache service to be removed can be specified with:

httpd.exe -k uninstall -n "MyServiceName"

Normally starting, restarting, and shutting down an Apache service is usually done through the Apache Service Monitor, with commands such as NET START Apache2.4
and NET STOP Apache2.4
, or by using normal Windows service management. Before starting Apache as a service in any way, you need to check the service configuration file using:

httpd.exe -n "MyServiceName" -t

You can also control the Apache service using command line switches. To start the installed Apache service you need to use this:

httpd.exe -k start -n "MyServiceName"

To stop the Apache service via command line switches, use this:

httpd.exe -k stop -n "MyServiceName"

httpd.exe -k shutdown -n "MyServiceName"

You can also restart a running service and force it to reread the config file using:

httpd.exe -k restart -n "MyServiceName"

By default, all Apache services are registered to run as the system user (LocalSystem account). The LocalSystem account is not authorized to access your network through any Windows-secured mechanism, including the file system, named pipes, DCOM, or secure RPC. However, it has wide privileges at the local level.

Never grant any network privileges to the LocalSystem account! If you need Apache to access network resources, create a separate account for Apache as shown below.

Users are advised to create a separate account to run Apache services. If you need to access network resources through Apache, this is required.

  1. Create a regular domain user account and be sure to remember its password.
  2. Grant the newly created user the privilege to login as a service
    and act as part of the operating system
    . In Windows NT 4.0, these privileges are granted through User Manager for Domains, but in Windows 2000 and XP, you probably want to use Group Policy to propagate these settings. You can also install them manually using the Local Security Policy MMC snap-in.
  3. Make sure the created account is a member of the “Users” group.
  4. Grant the account read and execute (RX) rights to all document and script folders (e.g. htdocs
    and cgi-bin
  5. Grant rights to change account (RWXD) in directory logs
  6. Give the account read and execute (RX) rights to the binary executable httpd.exe

It is generally recommended to give the user read-execute (RX) access to the Apache service for the entire Apache2.4 directory, except for the subdirectory logs
, where the user must have at least Modify (RWXD) rights.

Error code 2186 is a good sign that you need to review the “Login” configuration for the service because Apache cannot access the required network resource. Also pay close attention to the privileges of the user configured to run Apache.

When running Apache as a service, you may get an error message from the Windows Service Control Manager. For example, if you try to start Apache using the Services applet in the Windows Control Panel, you might get the following message:

Could not start the Apache2.4 service on \\COMPUTER
Error 1067; The process terminated unexpectedly.

(Could not start Apache2.4 service on \\ COMPUTER
Error 1067; The process ended unexpectedly.)

You will get this generic error if you have problems starting the Apache service. To see what is really causing the problem, you should follow the instructions for running Apache for Windows from the command line.

If you’re having problems with the service, it’s recommended that you follow the instructions below to try and run httpd.exe from a console window and fix the errors before trying to run it as a service again.

Running Apache as a Console Application

Running Apache as a service is usually the recommended way to use it, but sometimes it’s easier to work from the command line, especially during initial setup and testing.

To run Apache from the command line as a console application, use the following command:

Apache will run and run until it is stopped by pressing Control-C.

You can also start Apache using the “Run Apache” shortcut in the console located in the menu Start -> Programs -> Apache HTTP Server 2.4.xx -> Manage Apache Server
during installation. This will open a console window and start Apache inside it. If you don’t have Apache installed as a service, the window will remain until you stop Apache by pressing Control-C in the console window where Apache is running. The server will close in a few seconds. However, if you have Apache installed as a service, the shortcut starts the service. If the Apache service is already running, the shortcut does nothing.

If Apache is running as a service, you can stop it by opening another console window and typing:

httpd.exe -k shutdown

Running as a service should be preferred over running in a console window because it allows Apache to complete any ongoing operations and clean up gracefully.

But if the server is running in a console window, you can only stop it by pressing Control-C in the same window.

You can also restart Apache. This forces it to reread the config file. Any operations in progress are allowed to be performed without interruption. To restart Apache, press Control-Break in the console window you used to start Apache, or type

httpd.exe -k restart

if the server is running as a service.

Note for people familiar with the Unix version of Apache: These commands provide the Windows equivalent to kill -TERM pid
and kill -USR1 pid
. Command line option to use -k
was chosen as a reminder of the command kill
used in Unix.

If the Apache console window closes immediately or unexpectedly after startup, open a command prompt from the menu Start -> Programs
. Go to the folder where you installed Apache, enter command httpd.exe
and read the error message. Then go to the folder logs
and view the file error.log
for configuration errors. Assuming httpd is installed in C:\Program Files\Apache Software Foundation\Apache2.4\
, you can do the following:

cd "\Program Files\Apache Software Foundation\Apache2.4\bin"

Then wait for Apache to stop or press Control-C. Then enter the following:

cd .\logs
more <error.log

When working with Apache it is important to know how it will find the configuration file. You can specify a configuration file on the command line in two ways:

  • -f
    specifies an absolute or relative path to a specific configuration file:
  • httpd.exe -f "c:\my server files\anotherconfig.conf"

    httpd.exe -f files\anotherconfig.conf

  • -n
    specifies the installed Apache service whose configuration file will be used:
  • httpd.exe -n "MyServiceName"

In both these cases, the correct ServerRoot
must be set in the config file.

:/>  Не удалось создать новый или найти существующий раздел

If you don’t specify a config file with -f
or -n
, Apache will use the filename compiled on the server, e.g. conf\httpd.conf
. This built-in path is relative to the installation directory. You can check the name of the compiled file against the value marked as SERVER_CONFIG_FILE
, when calling Apache with the -V switch
, like this:

Apache will then try to determine its ServerRoot
by doing the following in the following order:

  1. Directive ServerRoot
    via command line switch -C
  2. Key -d
    on the command line.
  3. Current working directory.
  4. Registry entry that was created if you performed a binary installation.
  5. Server root compiled into server. Default is /apache
    , you can check it with httpd.exe -V
    and find the value marked as HTTPD_ROOT

If you didn’t do a binary install, Apache will complain about a missing registry key in some cases. This warning can be ignored if the server could otherwise find its configuration file.

The value of this key is the ServerRoot directory, which contains the subdirectory conf
. When Apache starts up, it reads the file httpd.conf
from this directory. If this file contains a ServerRoot directive that contains a directory other than the directory obtained from the registry key above, Apache will forget the registry key and use the directory from the configuration file. If you are copying the Apache directory or configuration files to a new location, it is very important to update the ServerRoot directive in the httpd.conf file
to reflect the new location.

Installation testing

After starting Apache (in a console window or as a service), it will listen on port 80 (unless you have changed the directive Listen
in the config files or have not installed Apache for the current user only). To connect to the server and access the default page, launch your browser and enter this URL:

Apache should respond with a welcome page and you should see “It Works!”. If nothing happens or if you get an error, check the file error.log
in subdirectory logs
. If your host is not connected to the network, or you have serious problems with your DNS (Domain Name Service) configuration, you may have to use this URL:

If you are running Apache on an alternate port, you need to explicitly specify this in the URL:

Once your base installation is up and running, you should set it up properly by editing the files in the conf subdirectory
. Again, if you change the configuration of an Apache Windows NT service, first try to start it from the command line to make sure the service starts without errors.

Because Apache cannot share the same port with another TCP/IP application, you may need to stop, remove, or reconfigure some other services before starting Apache. These conflicting services include other WWW servers, some firewall implementations, and even some client applications (such as Skype) that will use port 80 to try and work around firewall issues.

Setting access to network resources

Network access to files can be specified using two mechanisms provided by Windows:

Mapped drive letters

, Alias "/images/" "Z:/"

UNC paths

, Alias "/images/" "//imagehost/www/images/"

Mapped drive letters allow an administrator to maintain mapping to a specific machine and path outside of the Apache httpd configuration. However, these mappings are only related to interactive sessions and are not directly available to Apache httpd when it is running as a service. Use only UNC paths for network resources in httpd.conf so that resources can be accessed consistently regardless of how Apache httpd is started. (Arcane and error-prone procedures can bypass the mapped drive letter limit, but this is not recommended.)

Example DocumentRoot with UNC path
DocumentRoot "//dochost/www/html/"

When running Apache httpd as a service, you need to create a separate account to access network resources as described above.

Windows Setup

  • If more than a few dozen pipelined recorders are used in an operating system instance, it is often necessary to increase the “desktop heap”. For more information, see the documentation for the log.

Issuing a self-signed Windows certificate

Unlike IIS, the certificate for Apache is issued using third-party OpenSSL software.

After downloading the installation distribution, you need to run it.

On the first page, you must agree to the terms of the license agreement (switch the switch to “I accept the agreement”) and click the “Next” button.

Httpd exe k install

The wizard will switch to the distributive placement page. If you do not plan to change the location, you can leave the field at the default value and click the “Next” button.

Httpd exe k install

At the next step, nothing needs to be changed and you can just click “Next”.

Httpd exe k install

The distribution kit is ready for installation. You need to press the “Install” button and wait for the installation to complete.

Httpd exe k install

The final step is the donation page to support the project. If the plans do not include the transfer of donations, then you must uncheck all the boxes and click the Finish button.

Httpd exe k install

The OpenSSL distribution kit is installed and now you can proceed to certificate generation.

To do this, you need to run the command line interpreter as Administrator.

Now we need to check that the executable file is available from the environment variables of the operating system. You need to enter openssl and if a message similar to the one in the picture is displayed, then use the instruction
by adding the bin directory to the PATH environment variable.

The bin directory for OpenSSL was specified in the second step of the installer.

Httpd exe k install

If you had to add the bin directory to the environment variables, then you need to restart the command line as an administrator. Otherwise, if the input went into the OpenSSL configuration mode, you need to press the key combination Ctrl + C.

Next, you need to go to the Apache directory and create a folder where the certificate files will be located.

Httpd exe k install

After creation, you need to go to the created directory.

Httpd exe k install

After that, you need to enter the certificate generation command, where instead of you need to substitute the name of the computer on which you plan to host Apache:

Copy to clipboard

 openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout key -out crt 

Httpd exe k install

Several questions will be asked during the execution of the command. For “Common Name (e.g. server FQDN or Your bane)” you must also specify the name of the server. The remaining fields are filled in arbitrarily (except for “Country name” – here you can leave it by default).

Work Plan

  1. Installing Apache under Windows.
  2. Issue a self-signed Windows certificate (Optional).
  3. Certificate generation.
  4. Publishing the Windows infobase.
  5. Checking the publication.

Unlike IIS, the Apache web server is available for both Windows and Linux and allows you to set up publishing via the encrypted http protocol.

Installing Apache 2

Step 1.
On site
there is no Apache 2.4 version for Windows. Therefore, we will take the distribution kit at
. At the time of writing, the latest release is Apache 2.4.25 win64

Httpd exe k install

Apache distribution does not have an installation file
. Therefore, the installation will be done manually.

Step 4 .
Download apache 2/4/25 win64
and the Visual Studio 2015 C++ Redistributable component: vc_redist_x64/86.exe

Step 5
Create a folder and extract the archive httpd-2.4.25-win64-VC14 .zip
temporary folder. Copy folder Apache24
to drive C. Do not change the path. Let it be C:\Apache24

. There will be much fewer edits in the configuration file if the route is C:\Apache24

Step 6
Using notepad, edit the configuration file httpd.conf
, set along the route



Line 46
Set the value of the parameter ServerName



LoadModule foo_module modules/

Line 179
Set the value of the parameter DocumentRoot
(location of site documents). I left this route as default

Step 7
Executable files Apache
located in the folder C:\Apache24\bin
. Add this value to the environment variable PATH Windows

Httpd exe k install

Step 8
Before installing Apache as a service, you need to run the Visual Studio 2015 C++ Redistributable component: vc_redist_x64/86.exe

Step 9
Install Apache as a service.

The executable files are located in the folder To do this, open the command panel (Start > Run > cmd) with administrator rights
and with the cd command we change the directory so that it is C:\Apache24\bin > and run

httpd.exe -k

Note that I forgot to step 8
before starting the Apache service. As a result, without the C ++ Redistributable component, Visual Studio 2015 does not start Apache due to the fact that the library is needed vcruntime140.dll
in the folder C:\Windows\SysWOW64 (and for 32 bits in the folder C:\Windows\System32).

Httpd exe k install

A similar message is given by the service test parameter httpd.exe -t

Step 10
After starting the apache service httpd.exe -k start ,
open the list of running services in computer management and find the apache 2.4 service

Httpd exe k install

make sure that the service is running and the startup type is “automatic”

If the server does not start, you should check if port 80, which is used by Apache by default, is not busy. This is done using the command

Most often this port is used by Skype or Firefox. In this case, either release the port or move Apache to port .

To do this, change the values ​​of the and parameters in the file.

After that, restart the service with the command

and again try to visit the address http://localhost

For the convenience of working with the Apache server, you can install it in the Windows startup menu
shortcut pointing to C:\TestServer \Apache24\bin\ ApacheMonitor.exe

:/>  Куда сохраняются скриншоты на Виндовс 10: где хранятся снимки экрана, в какой папке находятся на компьютере, как её посмотреть?

Publishing a Windows infobase

Before publishing the database, you need to edit the file located in the Apache distribution directory in any convenient editor.

Copy to clipboard


You need to find the VirtualHost _default_:443 section in the file and replace SSLCertificateFile and SSLCertificateKeyFile in it with the full paths to the key and private file of the certificate, to the files prepared in advance.

Copy to clipboard

 SSLCertificateFile "${SRVROOT}/certs/server1.crt"

After that, you can proceed to the publication of the database.

To publish an infobase, open the specific database configurator as an administrator and go to the “Administration” menu item. Then select “Publish infobase”.

In the publishing window, specify the name of the publication and optionally define the directory where the publishing settings will be located. It can also be left as default.

After that, you need to click the “Publish” button and wait until the end of the operation.

Httpd exe k install

Check publication

To check the correct operation, you need to open the page in a browser and follow the link, which consists of two parts:

  • Your server name (for example, server1)
  • Database publication name (which was specified in the publication settings window)

For such parameters, the link will look like:

Httpd exe k install

Installing Apache on Windows

In the command line, go to the directory of the unpacked Apache using the cd command. For example:

Copy to clipboard

 cd C:\Apache24 

Httpd exe k install

In the Apache directory, enter the command:

Copy to clipboard

 httpd.exe -k install 

Httpd exe k install

This will install the Apache service, which can be managed in the services window.

Httpd exe k install

This completes the installation of Apache. It remains only to publish the infobase and specify the certificate files in the Apache settings.

Server software

In order for a computer to act as a network server, it is necessary to install the server part of the network operating system, which allows you to maintain resources and distribute them among network clients. An important issue for network servers is the ability to restrict access to network resources. This is called network security. It provides controls over what resources users can access, the extent of that access, and how many users can access it at the same time. This control ensures privacy and security and maintains an efficient network environment.

In addition to providing control over network resources, the server performs the following functions:

  • provides logon identification for users;
  • manages users and groups;
  • stores network administration tools for management, control and audit;
  • provides fault tolerance to protect network integrity.

Web server installation (Apache 2.4, MySQL 8.0, PHP 7, phpMyAdmin)

The local server is a very useful tool. It will definitely come in handy for webmasters, PHP programmers, penetration testers. All of the programs included in a typical web server installation are free, and all are open source. A local web server consumes a minimum of resources and, in fact, it is not difficult to install and configure it at all.

This tutorial will tell you how to install a local web server without using ready-made assemblies. This method has its advantages. The most important of these are: full control over what you install; the ability to use the latest software versions.

Preparation (downloading the programs included in the server, creating the server structure)

  • Apache
    (web server directly)
  • PHP
    – environment for running PHP programs (required by almost all websites)
  • MySQL
    – database management system (required by most websites)
  • phpMyAdmin
    – very handy database management tool

So, I have downloaded the following files:

  • vc_redist.x64.exe
  • vcredist_x64.exe

Creating a web server structure

Let’s create the directory structure of our server. The main idea is to separate executable files and site files from databases. This is convenient for server maintenance, including backup.

At the root of the drive C:\
create directory Server
. In this directory, create 2 subdirectories: bin
(for executable files) and data

Go to directory data
and there create subfolders DB
(for databases) and htdocs
(for websites).

Go to directory C:\Server\data\DB\
and create an empty folder there data

Installing Apache 2.4

The contents of the downloaded archive (more precisely, only the directory Apache24
), extract to C:\Server\bin\

Go to directory c:\Server\bin\Apache24\conf\
and open the file httpd.conf
any text editor.

We need to replace a number of lines in it.

 Define SRVROOT "c:/Apache24"
 Define SRVROOT "c:/Server/bin/Apache24"
 ServerName localhost
 DocumentRoot "${SRVROOT}/htdocs"
 DocumentRoot "c:/Server/data/htdocs/"
 <Directory "${SRVROOT}/htdocs">
 <Directory "c:/Server/data/htdocs/">
 DirectoryIndex index.html
 DirectoryIndex index.php index.html index.htm
 # AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   AllowOverride FileInfo AuthConfig Limit
AllowOverride None
 # AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   AllowOverride FileInfo AuthConfig Limit
AllowOverride All
 #LoadModule rewrite_module modules/
 LoadModule rewrite_module modules/

Save and close the file. That’s it, Apache setup is complete! A description of each changed directive can be found on this page

Open a command prompt (this can be done by pressing the Win+X keys at the same time). Select Windows PowerShell (Administrator) there and copy there:

 c:\Server\bin\Apache24\bin\httpd.exe -k install

If you receive a request from the firewall against Apache, then click Allow.

Now enter into the command line:

 c:\Server\bin\Apache24\bin\httpd.exe -k start

Now in the browser we type http://localhost/
and see the following:

Httpd exe k install

This means two things:

  • Apache running
  • in directory c:\Server\data\htdocs\
    there is no file.

You can play around – add any html files to the directory – a full-fledged web server works.

Installing and configuring MySQL 8.0

To directory bin
unpack the MySQL files (from the archive Rename mysql-8.0.11-winx64 folder to mysql-8.0
(to be short). By the way, the unpacked mysql-8.0 folder takes up about a gigabyte!

Go to this folder and create a file there my.ini
Now open this file with any text editor.

Add the following lines there:


Save and close it.

The setup is completed, but you still need to perform initialization and installation, for this, open the command line as an administrator and enter in sequence:

 C:\Server\bin\mysql-8.0\bin\mysqld --initialize-insecure --user=root
C:\Server\bin\mysql-8.0\bin\mysqld --install
net start mysql

At the end of this process in the directory C:\Server\data\DB\data\
automatically generated files should appear.

Now the MySQL service will start every time you start Windows.

If initialization fails and in folder C:\Server\data\DB\data\
missing files, and in the error log


you see something like the following entries:


Then, to solve this problem, delete all the contents of the folder Httpd exe k install C:\Server\data\DB\data\
and to the file


add one more line:

  • Now initialize MySQL again:
  • Installing PHP 7

    Httpd exe k install In the folder


    create directory


    and copy the contents of the archive into it.
    In file


    add lines to the very end

    PHPIniDir "C:/Server/bin/PHP"
    AddHandler application/x-httpd-php .php
    LoadModule php7_module "C:/Server/bin/PHP/php7apache2_4.dll" 

    Httpd exe k install And restart Apache

    In directory c:\Server\data\htdocs\
    create a file called i.php

    Copy to this file:

     In a browser, open the link 


    . If you see the same as in the picture, then PHP is working:

     PHP 7 setup 

    PHP is configured in the file


    . There is no php.ini in the zip archives intended for manual installation and for updates (this is done on purpose so as not to accidentally overwrite your file with your unique settings). But there are two others, which are called php.ini-development and php.ini-production. Any of them, when manually installed, can be renamed to php.ini and configured further. On localhost we will use php.ini-development

    Open file php.ini
    any text editor, looking for a line

     ; extension_dir = "ext"

    and replace it with

     extension_dir = "C:\Server\bin\PHP\ext\"

    Now find the group of lines:

    ;extension=exif      ; Must be after mbstring as it depends on it
    ;extension=oci8_12c  ; Use with Oracle Database 12c Instant Client

    and replace it with:

    extension=exif      ; Must be after mbstring as it depends on it
    ;extension=oci8_12c  ; Use with Oracle Database 12c Instant Client

    now uncomment this group of lines:


    With these actions, we have enabled extensions. They may be needed in different situations for different scripts. Save the file and restart Apache

    6. Installing and configuring phpMyAdmin

    /* Servers configuration */
    $i = 0;
    /* Server: localhost [1] */
    $cfg['Servers'][$i]['verbose'] = '';
    $cfg['Servers'][$i]['host'] = 'localhost';
    $cfg['Servers'][$i]['port'] = '';
    $cfg['Servers'][$i]['socket'] = '';
    $cfg['Servers'][$i]['connect_type'] = 'tcp';
    $cfg['Servers'][$i]['extension'] = 'mysqli';
    $cfg['Servers'][$i]['auth_type'] = 'cookie';
    $cfg['Servers'][$i]['user'] = 'root';
    $cfg['Servers'][$i]['password'] = '';
    $cfg['Servers'][$i]['nopassword'] = true;
    $cfg['Servers'][$i]['AllowNoPassword'] = true;
    /* End of servers configuration */
    $cfg['blowfish_secret'] = 'kjLGJ8g;Hj3mlHy+Gd~FE3mN{gIATs^1lX+T=KVYv{ubK*U0V';
    $cfg['DefaultLang'] = 'ru';
    $cfg['ServerDefault'] = 1;
    $cfg['UploadDir'] = '';
    $cfg['SaveDir'] = '';

    Enter root as the username. Leave the password field blank. If everything is done correctly, then everything should look like this:

    Httpd exe k install

    Server usage and data backup

    In directory c:\Server\data\htdocs\
    create folders and files, for example:

    c:\Server\data\htdocs\test\ajax.php – this file, respectively, will be available at http://localhost/test/ajax.php, etc.

    To create a full backup of all sites and databases, just copy the directory C:\Server\data\

    Before updating modules, make a backup of the folder bin
    – in case of problems, it will be easy to roll back to previous versions.

    When you reinstall the server or upgrade it, you need to reconfigure the configuration files. If you have copies of these files, then the process can be greatly accelerated. It is advisable to back up the following files:

    • c:\Server\bin\Apache24\conf\httpd.conf
    • c:\Server\bin\mysql-8.0\my.ini
    • c:\Server\bin\PHP\php.ini
    • c:\Server\data\htdocs\phpMyAdmin\

    All settings are stored in them.

Оставьте комментарий