Setting up Apache: step-by-step instructions. Apache configuration file

httpd.conf - Apache server configuration

Apache is configured by placing directives in plain text configuration files. Apache server main configuration file - httpd.conf.
Other configuration files can be added using the Include directive. Any directive can be set in any of these configuration files.
Apache 2.4 is configured with files located in a subdirectory (by default) - conf(C:\Program Files\Apache Software Foundation\Apache2.4\conf\). These are the same files as for configuration on OS Unix, but there are several directives specifically intended for Windows.

The main Apache HTTP 2.4 server configuration file is usually called - httpd.conf.

It contains directives and parameters that control the operation of the Web server, virtual servers, and all Apache 2.4 software modules. . Apache is a modular server. This means that only the most basic functionality is included in the core server. Extension of functions is available using dynamically loaded modules. Configuration files contain one directive per line. The backslash "\" can be used as the last character on a line to indicate that the directive continues to the next line. There should be no other characters or spaces between the backslash and the end of the line. Directives in configuration files are case insensitive, but directive arguments are often case sensitive. Lines that begin with the "#" character are considered comments, and are ignored. Comments cannot be included on the line after a configuration directive. Empty lines and spaces before the directive are ignored.

Directive is a configuration command that controls one or more aspects of the Apache server's behavior.
Directives placed in the main configuration files apply to the entire server .

To check configuration files for syntax errors, use the command httpd.exe -t.

When installing Apache 2.4 the following were entered:

In Network Domain - server-apache24.ru
in Server Name - www.server-apache24.ru
in Administrator's Email Address ( Mailing address Administrator) - [email protected]

Hence, server-apache24.ru- will be the name of the main Apache server site.

The main Apache server site is configured in the file - httpd.conf.

Making changes to the Apache server configuration file - httpd.conf

To access the main Apache server site by domain name - server-apache24.ru, create a directory on the disk - C:\server-apache24.ru

server-apache24.ru

  • C:\server-apache24.ru
    • logs
      • access.log
      • error.log
    • www
      • index.html

directory server-apache24.ru

At the root of the disk C: need to create a directory server-apache24.ru
In him Necessarily there should be folders:
logs with "empty" files access.log And error.log
And
www with file index.html

See the lines in the httpd.conf file -
209 ServerAdmin [email protected]
218 ServerName www.server-apache24.ru:80
243 DocumentRoot "C:/server-apache24.ru/www"
245

httpd.conf - configuring Apache 2.4 server

httpd.conf.
The directives of the main configuration file apply to the entire server

All entries, except those highlighted in red, must be commented out. Lines starting with character "#" - these are comments.

# # This is the main Apache HTTP server configuration file. It contains the # configuration directives that give the server its instructions. # See for detailed information. # In particular, see # # for a discussion of each configuration directive. # # Do NOT simply read the instructions in here without understanding # what they do. They"re here only as hints or reminders. If you are unsure # consult the online docs. You have been warned. # # Configuration and logfile names: If the filenames you specify for many # of the server"s control files begin with " /" (or "drive:/" for Win32), the # server will use that explicit path. If the filenames do *not* begin # with "/", the value of ServerRoot is prepended -- so "logs/access_log" # with ServerRoot set to "/usr/local/apache2" will be interpreted by the # server as " /usr/local/apache2/logs/access_log", whereas "/logs/access_log" # will be interpreted as "/logs/access_log". # # NOTE: Where filenames are specified, you must use forward slashes # instead of backslashes (e.g., "c:/apache" instead of "c:\apache"). # If a drive letter is omitted, the drive on which httpd.exe is located # will be used by default. It is recommended that you always supply # an explicit drive letter in absolute paths to avoid confusion. # # ServerRoot: The top of the directory tree under which the server"s # configuration, error, and log files are kept. # # Do not add a slash at the end of the directory path. If you point # ServerRoot at a non -local disk, be sure to specify a local disk on the # Mutex directive, if file-based mutexes are used. If you wish to share the # same ServerRoot for multiple httpd daemons, you will need to change at # least PidFile. # ServerRoot "C:/Program Files/Apache Software Foundation/Apache2.4" # # Mutex: Allows you to set the mutex mechanism and mutex file directory # for individual mutexes, or change the global defaults # # Uncomment and change the directory if mutexes are file-based and the default # mutex file directory is not on a local disk or is not appropriate for some # other reason. # # Mutex default:logs # # Listen: Allows you to bind Apache to specific IP addresses and/or # ports, instead of the default. See also the # directive. # # Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses. # #Listen 12.34.56.78:80 Listen 80 # # Dynamic Shared Object (DSO) Support # # To be able to use the functionality of a module which was built as a DSO you # have to place corresponding `LoadModule" lines at this location so the # directives contained in it are actually available _before_ they are used. # Statically compiled modules (those listed by `httpd -l") do not need # to be loaded here. # # Example: # LoadModule foo_module modules/mod_foo.so # LoadModule access_compat_module modules/mod_access_compat.so LoadModule actions_module modules/mod_actions.so LoadModule alias_module modules/mod_alias.so LoadModule allowmethods_module modules/mod_allowmethods.so LoadModule asis_module modules/mod_asis.so LoadModule auth_basic_module modules/mod_auth_basic.so #LoadModule auth_digest_module modules/mod_auth_digest.so #LoadModule a uthn_anon_module modules/mod_authn_anon.so LoadModule authn_core_module modules/mod_authn_core. so #LoadModule authn_dbd_module modules/mod_authn_dbd.so #LoadModule authn_dbm_module modules/mod_authn_dbm.so LoadModule authn_file_module modules/mod_authn_file.so #LoadModule authn_socache_module modules/mod_authn_socache.so #LoadModule authnz_ldap_module modules/mod_authnz_ldap.so LoadModule authz_core_module modules/mod_authz_core.so #LoadModule authz_dbd_module modules/mod_authz_dbd.so #LoadModule authz_dbm_module modules/mod_authz_dbm.so LoadModule authz_groupfile_module modules/mod_authz_groupfile.so LoadModule authz_host_module modules/mod_authz_host.so #LoadModule authz_owner_module modules/mod_authz_owner.so LoadModule authz_user_module modules/mod_authz_user.so LoadModule autoindex_module modules/mod_autoindex.so # LoadModule buffer_module modules/mod_buffer.so #LoadModule cache_module modules/mod_cache.so #LoadModule cache_disk_module modules/mod_cache_disk.so #LoadModule cern_meta_module modules/mod_cern_meta.so LoadModule cgi_module modules/mod_cgi.so #LoadModule charset_lite_module modules/mod_charset_lite.so #LoadModule data_module modules /mod_data.so #LoadModule dav_module modules/mod_dav.so #LoadModule dav_fs_module modules/mod_dav_fs.so #LoadModule dav_lock_module modules/mod_dav_lock.so #LoadModule dbd_module modules/mod_dbd.so #LoadModule deflate_module modules/mod_deflate.so LoadMod ule dir_module modules/mod_dir. so #LoadModule dumpio_module modules/mod_dumpio.so LoadModule env_module modules/mod_env.so #LoadModule expires_module modules/mod_expires.so #LoadModule ext_filter_module modules/mod_ext_filter.so #LoadModule file_cache_module modules/mod_file_cache.so #LoadModule filter_module modules/mod_filter.so #LoadModule headers_module modules/mod_headers.so #LoadModule heartbeat_module modules/mod_heartbeat.so #LoadModule heartmonitor_module modules/mod_heartmonitor.so #LoadModule ident_module modules/mod_ident.so LoadModule imagemap_module modules/mod_imagemap.so LoadModule include_module modules/mod_include.so #LoadModule info_mod ule modules/mod_info .so LoadModule isapi_module modules/mod_isapi.so #LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so #LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so #LoadModule lbmethod_bytraffic_module modules/mod_lbmethod _bytraffic.so #LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so #LoadModule ldap_module modules/mod_ldap.so # LoadModule logio_module modules/mod_logio.so LoadModule log_config_module modules/mod_log_config.so #LoadModule log_debug_module modules/mod_log_debug.so #LoadModule log_forensic_module modules/mod_log_forensic.so #LoadModule lua_module modules/mod_lua.so LoadModule mime_module module s/mod_mime.so #LoadModule mime_magic_module modules/ mod_mime_magic.so LoadModule negotiation_module modules/mod_negotiation.so #LoadModule proxy_module modules/mod_proxy.so #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so #LoadModule proxy_connect_module modules/mod_proxy_connect.so #LoadModule proxy_express_module modules/mod_proxy_express.so #LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so #LoadModule proxy_html_module modules/mod_proxy_html.so #LoadModule proxy_http_module modules/mod_proxy_http.so #LoadModule proxy_scgi_module modules/mod_proxy_scgi. so #LoadModule ratelimit_module modules/mod_ratelimit.so #LoadModule reflector_module modules/mod_reflector.so #LoadModule remoteip_module modules/mod_remoteip.so #LoadModule request_module modules/mod_request.so #LoadModule reqtimeout_module modules/mod_reqtimeout.so #LoadModule rewrite_module modules/mod_rewrite.so #LoadModule sed_module modules/mod_sed.so # LoadModule session_module modules /mod_session.so #LoadModule session_cookie_module modules/mod_session_cookie.so #LoadModule session_crypto_module modules/mod_session_crypto.so #LoadModule session_dbd_module modules/mod_session_dbd.so LoadModule setenvif_module modules/mod_setenvif.so #LoadModule slotmem _plain_module modules/mod_slotmem_plain.so #LoadModule slotmem_shm_module modules/mod_slotmem_shm. so #LoadModule socache_dbm_module modules/mod_socache_dbm.so #LoadModule socache_memcache_module modules/mod_socache_memcache.so #LoadModule socache_shmcb_module modules/mod_socache_shmcb.so #LoadModule speling_module [email protected]#ServerAdmin [email protected] # # ServerName gives the name and port that the server uses to identify itself. # This can often be determined automatically, but we recommend you specify # it explicitly to prevent problems during startup. # # If your host doesn't have a registered DNS name, enter its IP address here. # ServerName www.server-apache24.ru:80 # # Deny access to the entirety of your server's filesystem. You must # explicitly permit access to web content directories in other # blocks below. # AllowOverride none Require all denied # # Note that from this point forward you must specifically allow # particular features to be enabled - so if something"s not working as # you might expect, make sure that you have specifically enabled it # below. # # # DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # # DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.4/htdocs" was DocumentRoot "C:/server-apache24.ru/www" # was # # Possible values ​​for the Options directive are "None", "All", # or any combination of : # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # //httpd.apache.org/docs/2.4/mod/core.html#options # for more information. # # Options Indexes FollowSymLinks was Options Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # 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 was AllowOverride All # # Controls who can get stuff from this server. # Require all granted AddHandler server-parsed .shtml .shtm .html .htm # # DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # DirectoryIndex index.html # # The following lines prevent .htaccess and .htpasswd files from being # viewed by Web clients. # Require all denied # # ErrorLog: The location of the error log file. # If you do not specify an ErrorLog directive within a # container, error messages relating to that virtual host will be # logged here. If you *do* define an error logfile for a # container, that host"s errors will be logged there and not here. # # ErrorLog "logs/error.log" was ErrorLog c:/server-apache24.ru/logs/error.log # # LogLevel: Control the number of messages logged to the error_log. # Possible values ​​include: debug, info, notice, warn, error, crit, # alert, emerg. # LogLevel warn # # The following directives define some format nicknames for use with # a CustomLog directive (see below). # LogFormat "%h %l %u %t \"%r\" %>s %b \"%(Referer)i\" \"%(User-Agent)i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common # You need to enable mod_logio.c to use %I and %O LogFormat "%h %l %u %t \"%r\" %> s %b \"%(Referer)i\" \"%(User-Agent)i\" %I %O" combinedio # # The location and format of the access logfile (Common Logfile Format). # If you do not define any access logfiles within a # container, they will be logged here. Contrariwise, if you *do* # define per- access logfiles, transactions will be # logged therein and *not* in this file. # # CustomLog "logs/access.log" common was CustomLog c:/server-apache24.ru/logs/access.log common # # If you prefer a logfile with access, agent, and referer information # (Combined Logfile Format) you can use the following directive. # #CustomLog "logs/access.log" combined # # Redirect: Allows you to tell clients about documents that used to # exist in your server"s namespace, but do not anymore. The client # will make a new request for the document at its new location. # Example: # Redirect permanent /foo //www.server-apache24.ru/bar # # Alias: Maps web paths into filesystem paths and is used to # access content that does not live under the DocumentRoot. # Example: # Alias ​​/webpath /full/filesystem/path # # If you include a trailing / on /webpath then the server will # require it to be present in the URL. You will also likely # need to provide a section to allow access to # the filesystem path. # # ScriptAlias: This controls which directories contain server scripts. # ScriptAliases are essentially the same as Aliases, except that # documents in the target directory are treated as applications and # run by the server when requested rather than as documents sent to the # client. The same rules about trailing "/" apply to ScriptAlias ​​# directives as to Alias. # # ScriptAlias ​​/cgi-bin/ "C:/Program Files/Apache Software Foundation/Apache2.4/cgi-bin/" was ScriptAlias ​​/cgi-bin/ "C:/server-apache24.ru/cgi-bin/" # # ScriptSock: On threaded servers, designate the path to the UNIX # socket used to communicate with the CGI daemon of mod_cgid. # #Scriptsock cgisock # # "C:/Program Files/Apache Software Foundation/Apache2.4/cgi-bin" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # # AllowOverride None Options None Require all granted # # TypesConfig points to the file containing the list of mappings from # filename extension to MIME-type. # TypesConfig conf/mime.types # # AddType allows you to add to or override the MIME configuration # file specified in TypesConfig for specific file types. # #AddType application/x-gzip .tgz # # AddEncoding allows you to have certain browsers uncompress # information on the fly. Note: Not all browsers support this. # #AddEncoding x-compress .Z #AddEncoding x-gzip .gz .tgz # # If the AddEncoding directives above are commented-out, then you # probably should define those extensions to indicate media types: # AddType application/x-compress . Z AddType application/x-gzip .gz .tgz AddType application/x-httpd-php .php # # AddHandler allows you to map certain file extensions to "handlers": # actions unrelated to filetype. These can be either built into the server # or added with the Action directive (see below) # # To use CGI scripts outside of ScriptAliased directories: # (You will also need to add "ExecCGI" to the "Options" directive.) # #AddHandler cgi-script .cgi AddHandler cgi-script .cgi .pl # For type maps (negotiated resources): #AddHandler type-map var # # Filters allow you to process content before it is sent to the client. # # To parse .shtml files for server-side includes (SSI): # (You will also need to add "Includes" to the "Options" directive.) # AddType text/html .shtml AddOutputFilter INCLUDES .shtml # # The mod_mime_magic module allows the server to use various hints from the # contents of the file itself to determine its type. The MIMEMagicFile # directive tells the module where the hint definitions are located. # #MIMEMagicFile conf/magic # # Customizable error responses come in three flavors: # 1) plain text 2) local redirects 3) external redirects # # Some examples: #ErrorDocument 500 "The server made a boo boo." #ErrorDocument 404 /missing.html #ErrorDocument 404 "/cgi-bin/missing_handler.pl" #ErrorDocument 402 //www.server-apache24.ru/subscription_info.html ErrorDocument 404 C:/server-apache24.ru/www/404error .html ErrorDocument 500 C:/server-apache24.ru/www/500error.html # # MaxRanges: Maximum number of Ranges in a request before # returning the entire resource, or one of the special # values ​​"default", "none" or "unlimited". # Default setting is to accept 200 Ranges. #MaxRanges unlimited # # EnableMMAP and EnableSendfile: On systems that support it, # memory-mapping or the sendfile syscall may be used to deliver # files. This usually improves server performance, but must # be turned off when serving from networked-mounted # filesystems or if support for these functions is otherwise # broken on your system. # Defaults: EnableMMAP On, EnableSendfile Off # #EnableMMAP off #EnableSendfile on # Supplemental configuration # # The configuration files in the conf/extra/ directory can be # included to add extra features or to modify the default configuration of # the server, or you may simply copy their contents here and change as # necessary. # Server-pool management (MPM specific) #Include conf/extra/httpd-mpm.conf # Multi-language error messages Include conf/extra/httpd-multilang-errordoc.conf # Fancy directory listings Include conf/extra/httpd-autoindex .conf # Language settings Include conf/extra/httpd-languages.conf # User home directories Include conf/extra/httpd-userdir.conf # Real-time info on requests and configuration #Include conf/extra/httpd-info.conf # Virtual hosts Include conf/extra/httpd-vhosts.conf # Local access to the Apache HTTP Server Manual #Include conf/extra/httpd-manual.conf # Distributed authoring and versioning (WebDAV) #Include conf/extra/httpd-dav. conf # Various default settings Include conf/extra/httpd-default.conf # Configure mod_proxy_html to understand HTML4/XHTML1 Include conf/extra/proxy-html.conf # Secure (SSL/TLS) connections #Include conf/extra/httpd-ssl .conf # # Note: The following must be present to support # starting without SSL on platforms with no /dev/random equivalent # but a statically compiled-in mod_ssl. # SSLRandomSeed startup builtin SSLRandomSeed connect builtin # # uncomment out the below to deal with user agents that deliberately # violate open standards by misusing DNT (DNT *must* be a specific # end-user choice) # # #BrowserMatch "MSIE 10.0;" bad_DNT # # #RequestHeader unset DNT env=bad_DNT #


Changes .
Team - httpd.exe -k restart, allows any operations the Apache server is performing to complete and forces Apache to re-read the configuration file.


Troubleshooting errors when installing Apache server

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 computer on the network.

Restarting Apache 2.4

Because changes in the main configuration files will only take effect when the Apache server is started or rebooted,
you need to restart the server.

ApacheMonitor

The ApacheMonitor icon can be seen by clicking on the button - display hidden icons

Double left click on the icon Apache Service Monitor.

You can restart the Apache server by clicking the button Restart
in the Apache Service Monitor window.
Or - Stop and then - Start.

If you only made changes to the httpd.conf file,

then by entering in the address bar of the browser - localhost or - 127.0.0.1 ,
you will see a page - Error 403.

Access forbidden!

You don"t have permission to access the requested directory. There is either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.

Error 403

127.0.0.1
Apache/2.4.4 (Win64)

Access is denied!

You do not have permission to access the requested directory. There is no index document or the catalog is read-protected.
If you think this is a server error, please contact your webmaster.

Error 403

Login with administrator rights to the command line - Administrator - Command Line
and enter:
"C:\Program Files\Apache Software Foundation\Apache2.4\bin\httpd.exe" 2> C:\errapache.txt

Microsoft Windows (c) 2016 Microsoft Corporation. All rights reserved. C:\Windows\system32> "C:\Program Files\Apache Software Foundation\Apache2.4\bin\httpd.exe" 2> C:\errapache.txt C:\Windows\system32>

On disk C:/ a file will be created errapache.txt


AH00112: Warning: DocumentRoot does not exist AH00112: Warning: DocumentRoot does not exist (OS 10048) Typically only one use of a socket address (protocol/network address/port) is allowed. : AH00072: make_sock: could not bind to address [::]:80 (OS 10048) Typically only one use of a socket address (protocol/network address/port) is allowed. : AH00072: make_sock: could not bind to address 0.0.0.0:80 AH00451: no listening sockets available, shutting down AH00015: Unable to open logs

AH00112: Warning:
C:/Program Files/Apache Software Foundation/Apache2.4/docs/dummy-host.server-apache24.ru
C:/Program Files/Apache Software Foundation/Apache2.4/docs/dummy-host2.server-apache24.ru
They don't exist.

But the main thing is OS errors 10048:

Could not bind to address [::]:80
could not bind to address 0.0.0.0:80

Go to the command line and enter:
netstat -aon

Administrator: Command Line

Microsoft Windows (c) 2016 Microsoft Corporation. All rights reserved. C:\Windows\system32> netstat -aon Active connections Name Local address External address PID status TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 1612 TCP [::]:80 [::]:0 LISTENING 1612 TCP 127.0.0.1:49693 127.0.0.1:49694 ESTABLISHED 5612 TCP 127.0.0.1:49694 127.0.0.1:49693 ESTABLISHED 5612 TCP 127.0.0.1:51341 0.0.0.0:0 LISTENING 3920 TCP 127.0.0.1:52006 0.0.0.0:0 LISTENING 3708 TCP 192.168.0.100:139 0.0.0.0:0 LISTENING 4 TCP 192.168.0.100:51330 34.226.135.28:443 ESTABLISHED 1232 TCP 192.168.0.100:51345 52.196.85.70:443 ESTABLISHED 1232 TCP 192.168.0.10 0:52796 88.212.253.127:21 ESTABLISHED 1128 TCP 192.168.0.100:53160 151.101.112.134 :443 CLOSE_WAIT 3712 TCP 192.168.0.100:53161 151.101.112.134:443 CLOSE_WAIT 3712 TCP 192.168.0.100:53162 151.101.128.134:443 CLOSE_WAIT 3712 TCP 192.168.0.100:53176 151.101.112.134:443 ESTABLISHED 3712 TCP 192.168.0.100:53179 151.101 .128.233:443 CLOSE_WAIT 3712 TCP 192.168.0.100:53192 151.101.112.64:443 CLOSE_WAIT 3712 TCP 192.168.0.100:53223 23.61.217.175:443 CLOSE_WAIT 3712 TCP 192.168.0.100:53230 185.29.133.52:443 CLOSE_WAIT 3712 TCP 192.168.0.100: 53246 2.18.74.149:443 CLOSE_WAIT 3712 TCP 192.168.0.100:53271 52.205.235.141:443 ESTABLISHED 5236 C:\Windows\system32>

The Process ID, better known as the PID, is a unique number. Each process running on the system has a unique identifier.
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 1612
TCP [::]:80 [::]:0 LISTENING 1612

Open Task Manager

Only Apache2.4 service has PID - 1612

In the catalog C:/Program Files/Apache Software Foundation/Apache2.4/conf/extra/
open the file in Notepad - httpd-vhosts.conf

Before making any changes, make a backup copy of the file - httpd-vhosts.conf.

Replace in VirtualHost sections
on

httpd-vhosts.conf - contents of the Apache 2.4 server configuration file

# Virtual Hosts # # Required modules: mod_log_config # If you want to maintain multiple domains/hostnames on your # machine you can setup VirtualHost containers for them. Most configurations # use only name-based virtual hosts so the server doesn't need to worry about # IP addresses. This is indicated by the asterisks in the directives below. # # Please see the documentation at #

In the catalog C:\Windows\System32\drivers\etc\
open the file in Notepad - hosts
And add the line to it:

127.0.0.1 localhost www.server-apache24.ru server-apache24.ru

Restart the Apache server by clicking the button Restart
in Apache Service Monitor.

Enter into the address bar of your browser - server-apache24.ru
and you will see the index page of the main website of the Apache2.4 server that you created

The site index page should be located in the www subdirectory (C:\server-apache24.ru\www\)

After installing Apache 2.4 server, go to the command line and enter the commands:

httpd.exe -t

You will receive two warnings.

Administrator: Command Line

Microsoft Windows (c) 2016 Microsoft Corporation. All rights reserved. C:\Windows\system32> cd C:\Program Files\Apache Software Foundation\Apache2.4\bin\ C:\Program Files\Apache Software Foundation\Apache2.4\bin> httpd.exe -t AH00112: Warning: DocumentRoot does not exist AH00112: Warning: DocumentRoot does not exist Syntax OK C:\Program Files\Apache Software Foundation\Apache2.4\bin>

andew

2016-07-23T17:54:43+00:00

2017-08-25T04:44:37+00:00

7613

The article provides an overview of the configuration of the Apache web server in Ubuntu server with the standard installation of LAMP in Ubuntu. The logic and structure of organizing web server configuration files is given. The purposes of the main server configs are described. Basic ones are given Linux Ubuntu commands for manipulating the configuration, configuring and managing the Apache web server. Considered the default site, which is created during the Apache installation process. This article will be useful to you when setting up and administering your LAMP server.

How to add support PHP as a script processor in Apache on Ubuntu or Windows described in detail in the article Installing PHP7 on Windows In chapter Settings.

Apache Default WEB Page

During a standard web server installation Apache V Ubuntu server a test site is created, which serves to test the functionality of the web server after its installation. This site, by default, is configured to allow browser access only to files and directories within /var/www directories Ubuntu server. If, upon completion of installation Apache, you will open a web page in your browser at the address IP your web server, you will see home page servers - Apache2 Ubuntu Default Page. This will, first of all, say that Apache installed successfully and works. This page is physically located on the server in a file /var/www/html/index.html and the default virtual host config is responsible for its configuration and output in the browser ( /etc/apache2/sites-available/000-default.conf), which defines the virtual host (site) for the directory /var/www/html and is created during server installation Apache. Accordingly, if you place your files in this folder, they will be processed by the web server. Also on this Default Page in section Configuration Overview you will see a schematic representation of the server configuration file structure. Here you need to understand that the structure, names and locations of configs Apache V Ubuntu differ from the generally accepted scheme, which is done for the convenience of server management. But there is one caveat here, which is that if you were not previously familiar with organizing directories in the home directory Apache on Ubuntu, then this diagram can only confuse you, because it does not represent all folders, but only the directories in which symbolic links to activated configuration files. Therefore, for a more correct understanding, see the complete directory and file diagram of the home directory of the Apache web server located below in this article. Among the valuable things in the Apache web page section are links to man"s Debian for teams a2enmod, a2dismod, a2ensite, a2dissite, a2enconf, a2disconf, which are used to activate and deactivate certain types of configuration files and will be described in detail. It also says here that to send commands to the web server ( started/stopped etc.) need to contact /etc/init.d/apache2 or to apache2ctl, which is also a feature of the server in Ubuntu. On the Ubuntu server in the file /usr/share/doc/apache2/README.Debian.gz you can find complete documentation for Apache.

Apache Home Directory on Ubuntu

Default, home web server directory Apache V Ubuntu be on /etc/apache2/ way to file system. All configuration files are located in this directory and its subdirectories. Apache. You can change the path value of the web server's home directory using the ServerRoot "/etc/apache2" directive in the main config apache2.conf. There, by default, the ServerRoot directive is commented out, which is equivalent to its value as "/etc/apache2" ( There should not be a trailing slash in this directive!). Home directory path value Apache(ServerRoot) is necessary for the server to know where in the file system it should look for its configuration files. Also, the ServerRoot value can expose oneself by the server in some directives expecting as an argument path in the file system Ubuntu. Therefore, in such cases, if the path is specified without primary slash, then Apache will take it as relative path towards your home directories. So, for example, if you specify the AuthUserFile .htpasswd directive, then in this version Apache will interpret the specified path as relative and turn it into /etc/apache2/.htpasswd, substituting in front the value of your path home directories.

Apache Home Directory Structure on Ubuntu

In progress standard WEB server installation Apache V Ubuntu The following structure of files and directories in the home directory of the web server is created:

/etc/apache2/ ...................................Apache home directory in Ubuntu - ServerRoot |-- conf-available...................directory, contains different configs | `-- charset.conf ...................file for specifying encodings | `-- localized-error-pages.conf .....file for setting error pages | `-- other-vhosts-access-log.conf ...file for specifying virtual host logs | `-- security.conf ......file for security directives | `-- serve-cgi-bin.conf ......file for CGI configuration directives |-- conf-enabled activated configs from conf-available| `-- @ ........................... LINKS to activated configs from conf-available |-- mods-available......................directory containing configs of installed Apache modules | `-- ...........................available configs of Apache modules |-- mods-enabled........................ directory, contains LINKS to activated module configs from mods-available| `-- @ ..................... LINKS to activated configs of Apache modules |-- sites-available....................directory contains available virtual host configs | `-- 000-default.conf ...............default virtual host file for port 80, created during Apache installation | `-- default-ssl.conf ...............default virtual host file for port 443, created during Apache installation |-- sites-enabled.......................directory, contains LINKS to activated virtual host configs from sites-enabled| `-- @000-default.conf ...............link to the activated virtual host config |-- apache2.conf........................MAIN config of the Apache web server in Ubuntu |-- envvars .............................file with path settings for the Apache environment |-- magic ...............................Script file for the module mime_magic(this module is not active by default) |-- ports.conf ........................... file for the task ports on which Apache connections will be accepted

The examples given are presented from OS Ubuntu server 16.04 LTS, but the same will happen in other versions and distributions of Ubuntu, both in the server version and in the desktop version.

Apache configuration logic

As mentioned above, in Ubuntu used excellent from the original organizational structure of configuration files and directories for the web server Apache.

Firstly, V Ubuntu, configuration Apache divided into a bunch of different configs according to their functional purpose. For example, directives specifying port for the server, placed in a separate file ports.conf. Directives responsible for certain server security parameters are placed in a file security.conf. Thus, the directives are grouped according to their own sense into separate configuration files. This is quite logical and convenient when reading, editing, activating and deactivating configs. With this approach, each individual file becomes smaller and is highly specialized part of the configuration. However, you need to understand that such fragmentation is done solely for convenience and automation of setup and technically, if you want, you can write all the directives and settings in one file, it’s just that working with such a file will not be so convenient.

Secondly: center the entire configuration is main config Apache web servers - apache2.conf file. It is this file in first queue searches and reads web server Apache at startup or reboot. And already in this file using directives Include, where they are specified, all other specified configs are connected and loaded. This way all configuration files are combined into single web server configuration and this happens when Apache reads files by in order their connections, starting with main config. Therefore important note - order following the directives in the configuration Apache and correspondingly, order connecting config files is important, since directives read by the server later can override directives read by it earlier. You need to remember this when setting up the server.

Third: if you look at the directory structure home directories Apache, then you will see three couples directories with names like: directory_prefix-available/enabled. This logical structure is designed to distribute your configs across three groups, based prefix directory names, where conf-* these are directories for your other configs, mods-* these are directories for Apache module configs and sites-* these are the directories for your configs virtual hosts. The second part of the name of these directories -available/-enabled logically indicates those available in general and only active at the moment the configs. Yes in directories *-available everything is stored available to use configuration files, and already in directories like *-enabled symbolic links (shortcuts) only to those configs from *-available directories that should be read by the web server when loading the configuration. Apache reads only directories like *-enabled, therefore, only those configs for which there are in these directories are applied links. This approach provides an additional level of convenience in that it allows you to store all your configs in directories in the server's home directory, and only use necessary into current coins.

Fourth: web server configuration directives Apache have context() in which they operate. Concept context directives indicates where, at what level and in what config this directive is Maybe be used. The same directive can be allowed for use in only one type of context, or in several types of context. If a directive is used/written in a context that is invalid for it, then there will be error Apache web server when loading configuration, which will cause it to stop. Therefore, when writing your directives, always pay attention to the context of their application, which is always indicated in the documentation for the directive on the Apache website.

Fifthly: you need to understand that Apache reads and applies all active configs only when start or reboot. After startup, Apache no longer rereads the configuration. The exception is the file .htaccess, which is a local level file catalog site and re-read when everyone accessing this site directory. Accordingly, if you have made configuration parameter changes outside .htaccess file, then for them to take effect it is necessary reboot web server Apache.

Types of directive context:

  • server config - global directive level for use in general server configuration files outside And outside containers and outside file .htaccess;
  • virtual host- level virtual host to apply the directive in container;
  • directory- level catalog, the directive must be used inside containers , , , ;
  • .htaccess- level local directory site, the directive can be applied in a .

Configuration Management Commands

For convenience and automation of configuration management Apache V Ubuntu There are special commands, using which you can include or exclude certain configuration files from the server configuration, start and reboot the server, view and change the settings of environment variables Apache and much more.

Configuration Enable/Disable Commands

To activate and deactivate certain configs in Ubuntu are provided teams assistants in tune with available/enabled And prefix catalogue. For example, the command a2enconf, which can be deciphered as apache2-enable-conf, activates the configuration file specified in its argument from conf-available directory by creating a symbolic links in the catalog conf-enabled. Team a2disconf performs the opposite action, i.e. removes this link. Similar logic applies to other commands: a2enconf/a2disconf, a2enmod/a2dismod, a2ensite/a2dissite. But you can also manually create/delete symbolic links to the configs you need in directories like *-enabled.

Attention: for config changes to take effect, you need to execute reboot WEB server configuration Apache.

a2enconf/a2disconf

To enable or disable the desired config from the directory conf-available In the server configuration use the commands:

Enable config:

sudo a2enconf

Disable config:

sudo a2disconf

a2enmod/a2dismod

To activate the installed Apache module from the directory mods-available

Enable Apache module

sudo a2enmod

Disable Apache module

sudo a2dismod

a2ensite/a2dissite

To activate the virtual host configuration from the directory sites-available and deactivate it use the commands:

Enable Virtual Host in Apache

sudo a2ensite

Disable virtual host in Apache

sudo a2dissite

Apache Control Commands

IN Ubuntu, thanks to the use of environment variables, to access to the demon httpd web server can use calls like: /etc/init.d/apache2 or apache2ctl or apache2:

sudo/etc/init.d/apache2 sudo apache2ctl sudo apache2

Website hosting

Can be implemented in four ways:

    By default in the /var/www/html folder. Access is http://localhost/

    Main hosting settings. For example, http://localhost/phpmyadmin

    In any folder using the virtual hosts module. For example, http://mysite/

    In the user's public_html folder (userdir module). For example, http://localhost/~username

Installation

To install Apache, run in a terminal:

sudo apt-get install apache2

Settings

To apply changes in settings, you need to restart the Apache daemon: sudo service apache2 restart

In Ubuntu, the final configuration file (apache2.conf) is divided into several files located in different subdirectories. More details are written in the file comments. apache2.conf.

/etc/apache2/ |-- apache2.conf | `-- ports.conf |-- mods-enabled | |-- *.load | `-- *.conf |-- conf-enabled | `-- *.conf `-- sites-enabled `-- *.conf

Module settings are located in the directory /etc/apache2/mods-available. To enable or disable modules (module settings), use the appropriate a2enmod or a2dismod commands. Example of module connection:

sudo a2enmod< mod-name>

Your settings should be saved to files located in the directory /etc/apache2/conf-available. To enable or disable your settings, use the appropriate a2enconf or a2disconf commands. An example of connecting a file with your own settings:

sudo a2enconf< config-name>

Virtual host settings should be saved to files located in the directory /etc/apache2/sites-available. To connect virtual hosts, use the appropriate a2ensite or a2dissite commands. Example of connecting a virtual host:

sudo a2ensite< site-name>

Default encoding

To specify the default encoding, use the AddDefaultCharset directive in the file /etc/apache2/conf-available/charset.conf(or uncomment the corresponding line):

AddDefaultCharset UTF-8

Virtual Hosts

Virtual host configuration files are stored in /etc/apache2/sites-available/*.conf. By default, Apache already has one virtual host configured. Its settings are in the file 000-default.conf. You can use this virtual host as an example.

Example of setting up a virtual host:

#Host name ServerName host1.server1 #Host root folder DocumentRoot /var/www/host1.server1 #Permission to overwrite all directives using .htaccess AllowOverride All

Name the configuration file with your host name host1.server1.conf and save.

After creating the settings file, add your host name to /etc/hosts:

127.0.0.1 host1.server1

To enable the created virtual host, use the a2ensite utility:

sudo a2ensite host1.server1

The host is disconnected similarly to the a2dissite utility:

sudo a2dissite host1.server1

Modules

mod_userdir

The mod_userdir module allows you to use directories located in users' home directories to store web pages. By default, Apache looks for requested pages in the directory ~/public_html

mkdir ~/ public_html

To enable mod_userdir run:

sudo a2enmod userdir

and add the required user to the www-data group:

sudo adduser $USER www-data

then restart Apache:

The pages will be accessible at http://localhost/~username, where username is the username.

CGI

If you want to run cgi scripts on the server, connect the cgi module with the command

sudo a2enmod cgi

By default, cgi scripts are placed in the directory /usr/lib/cgi-bin, but you can place them anywhere by specifying this in your virtual host settings, or globally for all hosts in the file /etc/apache2/conf-enabled/serve-cgi-bin.conf.

If your server operates on an external network, then for security reasons it is strongly recommended to place cgi scripts outside the root directory of the virtual host

Setting up HTTPS in Apache

The Apache web server fully supports HTTPS. To enable HTTPS support on an already installed Apache, you must do the following.

Creating a key and SSL certificate

The use of self-signed certificates, although it protects against passive eavesdropping, does not guarantee clients that the server is exactly the server they need. The advantage of self-signed certificates is that they are free. A certificate signed by a Certificate authority costs money.

To create a key and certificate, enter the command:

Openssl req -new -x509 -days 30 -keyout server.key -out server.pem

To the question “Enter PEM pass phrase:” we answer with the password, confirm and remember.

We answer all subsequent questions randomly, you can simply click on Enter, agreeing with the proposed options, only answer the question “Common Name (eg, YOUR name):” with the name of the site for which we are creating a certificate, for example www.example.com.

After answering all the questions, two new files should appear in the directory - server.pem (key) and server.crt (certificate).

To use the generated key, we need to know the password we entered, and Apache will ask us for it when loading, but why do we need unnecessary questions from the daemons? :) Therefore, we remove the password from the key:

cp server.key( ,.orig) openssl rsa -in server.key.orig -out server.key rm server.key.orig

Let's copy them to /etc/ssl and assign read rights to the key file only to the administrator:

sudo cp server.pem / etc/ ssl/ certs/ sudo cp server.key / etc/ ssl/ private/ sudo chmod 0600 / etc/ ssl/ private/ server.key

Apache setup

First you need to activate mod_ssl:

sudo a2enmod ssl

And then enable the site's default HTTPS settings:

sudo a2ensite default-ssl

Now you need to edit the file with the default HTTPS site settings, indicating in it the paths to your certificates. The file itself is called /etc/apache2/sites-enabled/default-ssl (or /etc/apache2/sites-enabled/default-ssl.conf).

SSLEngine on

add line

SSLProtocol all -SSLv2

to disable the use of the legacy SSLv2 protocol.

# Server public certificate SSLCertificateFile /etc/ssl/certs/server.pem # Server private key SSLCertificateKeyFile /etc/ssl/private/server.key

Now just restart Apache:

sudo service apache2 restart

And if all parameters are specified correctly, your sites will become accessible via HTTPS.

The HTTPS protocol operates on port 443, so if the server is located behind a gateway, then you need to forward this port to it.

Redirecting HTTP requests to HTTPS

If you want to disable the use of HTTP, then the most sensible thing to do is to redirect all HTTP requests to pages to their HTTPS address. Let's do this using mod_alias. If it is not enabled, enable it:

sudo a2enmod alias sudo service apache2 restart

Then we change the /etc/apache2/sites-enabled/000-default file, which is responsible for the default virtual host for HTTP requests. Add a directive to this file

Redirect / https://example.com/

In this case, all directory settings can be deleted, since your sites will still not be accessible via HTTP.

That's it, now restart Apache again and make sure that when you access via HTTP you are automatically redirected to the HTTPS page.

Apache HTTP Server is a complex software product that runs on different platforms and operating systems around the world. Therefore, for correct operation on installed system it needs to be configured.
By default, Apache settings are located in the httpd.conf file in the conf directory. The following will describe the main directives of the httpd.conf file and their commonly used meanings.

Editing the httpd.conf file

1. To load the mod_rewrite module, find and uncomment (remove the “#” symbol at the beginning of the line) this line:
LoadModule rewrite_module modules/mod_rewrite.so
2. To load the PHP interpreter, you need to add the following line to the end of the module loading block:
LoadModule php5_module "C:/php/php5apache2_2.dll"
3. Define the directory containing the configuration PHP file by adding the following line below:
PHPIniDir "C:/php"
4. Find and uncomment the line:
ServerName localhost:80
5. Find the line:
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
Assign the root directory for site management (you already created it a little earlier):
DocumentRoot "C:/apache"
6. Find this block:

Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all

And replace it with the following:

Options Includes Indexes FollowSymLinks
AllowOverride All
Allow from all

7. Delete or comment out the original directory control block (we won't need it), which without comments looks something like this:

Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all

8. Find the block:

DirectoryIndex index.html

Replace it with:

DirectoryIndex index.html index.htm index.shtml index.php

9. Find the line:
ErrorLog "logs/error.log"
Replace with the following (in this case it will be more convenient to view the global server error file):
ErrorLog "C:/apache/error.log"
10. Find the line:
CustomLog "logs/access.log" common
Change to:
CustomLog "C:/apache/access.log" common
11. For SSI to work (server-side enablement), the following lines are located in the block , you need to find and uncomment:
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
12. Add below, in the same block , two lines:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
13. Finally, find and uncomment the lines:
Include conf/extra/httpd-autoindex.conf
Include conf/extra/httpd-vhosts.conf
Include conf/extra/httpd-manual.conf
Include conf/extra/httpd-default.conf
Save changes and close the "httpd.conf" file

Now open the file "httpd-vhosts.conf" located in the "conf\extra" directory and make the following changes in it:

The existing virtual host example blocks should be commented out or deleted and the following inserted:

DocumentRoot "C:/apache/localhost/www"
ServerName localhost
ErrorLog "C:/apache/localhost/error.log"
CustomLog "C:/apache/localhost/access.log" common

Example of creating a virtual host

If you need to install your own virtual hosts, do the following:

Open the file "httpd-vhosts.conf" and create a block in it with approximately the following content:

# The folder where your host's root will be.
DocumentRoot "C:/apache/test.ru/www"
# The domain by which you can access the virtual host.
ServerName test.ru
# Alias ​​(additional name) of the domain.
ServerAlias ​​www.test.ru
# The file where errors will be written.
ErrorLog "C:/apache/test.ru/error.log"
# Host access log file.
CustomLog "C:/apache/test.ru/access.log" common

Then in the "apache" directory, create a folder "test.ru" (just like that, with a dot), in which, in turn, create a folder "www".

The next step in creating a virtual host is to modify the C:\WINDOWS\system32\drivers\etc\hosts file of the operating system. Open this file and add two lines to it:
127.0.0.1 test.ru
127.0.0.1 www.test.ru

Now restart the Apache server with the "Restart" shortcut located in the "Start" menu, open the browser, enter test.ru or www.test.ru in the address bar and you will find yourself in your virtual host. Just be careful, now you can get to the original site with the name of the virtual host (www.test.ru if it exists) only by commenting out or deleting the line: 127.0.0.1 www.test.ru, in the above-mentioned "hosts" file.

Apache documentation, with the server running, is available at http://localhost/manual/

Installation and configuration of the Apache web server is completed.

Creating batch files to start and stop services

Agree that manually editing the "hosts" file every time you start services is not convenient, so for a more convenient, simultaneous start of Apache, MySQL services, and changing the "hosts" file, we will create two batch files: for starting and stopping, which will perform all routine work automatically.

When using virtual hosts, you need to create two files in the C:\apache directory: vhosts-off.txt - containing the initial contents of the "hosts" file and vhosts-on.txt - containing all virtual hosts. Please note that when creating new virtual hosts you will need to add them to the vhosts-on.txt file and not to C:\WINDOWS\system32\drivers\etc\hosts. Look at the examples below.

File vhosts-off.txt (can contain one single line):
127.0.0.1 localhost

Example of a vhosts-on.txt file with virtual hosts www.test.ru and test.ru:

127.0.0.1 localhost
127.0.0.1 www.test.ru
127.0.0.1 test.ru

In the same directory C:\apache, create two batch files: start-webserver.bat – to start services and replace the “hosts” file, and stop-webserver.bat – to stop services and clear the “hosts” file.

Launch file start-webserver.bat:

@echo off
echo.
if not exist C:\apache\vhosts-on.txt goto no_vhosts
echo Create virtual hosts:
copy /v /y C:\apache\vhosts-on.txt C:\WINDOWS\system32\drivers\etc\hosts
echo.
:no_vhosts
NET start Apache2.2
NET start MySQL

Stop file stop-webserver.bat:

@echo off
echo.
if not exist C:\apache\vhosts-off.txt goto no_vhosts
echo Restore hosts file:
copy /v /y C:\apache\vhosts-off.txt C:\WINDOWS\system32\drivers\etc\hosts
echo.
:no_vhosts
NET stop Apache2.2
NET stop MySQL

If you do not use virtual hosts or want to start services without replacing the "hosts" file, simply remove the files vhosts-on.txt and vhosts-off.txt from the C:\apache directory.

During this instruction, we will take a detailed look at installing the web server Apache, PHP, Tomcat (for JSP support) and binding them for collaboration. Let's take a look at a sample Apache configuration file. Then we will produce MySQL installation server and consider examples of accessing it from PHP and JSP. Let's install PHPMyAdmin to work with MySQL.

Required Components

I used the following versions, the latest ones if possible.
Apache 2.0.52
PHP 4.3.9
Tomcat 5.5.4
mod_jk 1.2.6
J2SDK 1.5.0
MySQL 4.1.7
Connector/J 3.1.6
PHPMyAdmin 2.6.0
Where can I get the necessary components?
Apache Web Server
http://httpd.apache.org/
PHP
http://www.php.net/
JSP

*Tomcat
http://jakarta.apache.org
* mod_jk
http://www.javaportal.ru/downloads/downloads.html
* Java
http://java.sun.com/

* MySQL Database

*Connector/J
http://dev.mysql.com/downloads/
* PHPMyAdmin
http://www.phpmyadmin.net/

Installing Apache

First, let's create a Server folder on drive C, where we will install everything we need. Let’s first download all the software we need, maybe the same versions that I used, or maybe higher.

We launch apache_2.0.52-win32-x86-no_ssl and see the welcome window:

Click “Next”.

A window appears where we are asked to familiarize ourselves with the license to use this product, select “I accept...” and click “Next”.

A little history, and “Next” again.

In the server information window, enter the data as shown in the picture above:
Network Domain: localhost
Server name: localhost
Administrator`s Email Address: localhost»@localhost

We will also select “For All Users, on 80 port, as a Service - Recommended”. And then “Next”

Select Custom to select all components to install.

We select everything for a complete installation, change the installation path to C: ServerApache2

Click “Next” again.

We observe the progress of the installation.

Installation completed. Has a stash appeared in the lower right corner?

If yes, then our web server is installed. Left-click on the icon and open the control panel:

Here we can start, stop, or restart our server.

Now let's test our server. Open your browser and enter http://localhost in the address bar. If you see the following result:

This means the server was installed successfully.

Installing PHP

Extract the contents of php-4.3.9-Win32.zip into the C:Server folder and rename the resulting folder “php-4.3.9-Win32” to “php4”.

Now we need to make it clear to the server that we have a PHP interpreter.

We add the following entry to the end of the configuration file of our server C:ServerApache2confhttpd.conf:

# Let the server know that we have a PHP interpreter ScriptAlias ​​/php4/ "C:/Server/php4/" Action application/x-httpd-php4 "/php4/php.exe" # Install extensions for PHP scripts AddType application/x- httpd-php4 .php .php3 .php4 .phtm .phtml

Save the file. We restart our server (restart button in the server control panel), have you forgotten how yet?

Now we need to check if this connection works. In the C:ServerApache2htdocs folder (this folder is the default root folder, accessible from http://localhost), create a file phpinfo.php with the following content:

Save. Open http://localhost/phpinfo.php in the browser, if everything went well you should see the following:

Installing JSP support

To do this, we need to install JDK version 1.5, since we will be installing Tomcat 5, and it does not work on versions below 1.5.

Run jdk-1_5_0-windows-i586.exe

We agree to the license agreement.

Let's leave everything as is

We also leave everything as is.

A dialog pops up to select the installation of plugins for existing browsers, as you can see I only have one.

JDK installed!!!

Let's start installing Tomcat 5.

Run jakarta-tomcat-5.5.4

We accept the greeting and license agreement

Select the full installation by checking all components.

Install everything in the same folder “Server”

We leave the configuration as default.

Checking the path to the JRE.

Installation progress

OK. all is ready. But for now Tomcat works on its own and is not associated with Apache.

Checking the functionality of Tomcat. Open http://localhost:8080/ in the browser, since Tomcat listens on port 8080 by default. If the result is positive, we should see the following:

Now our task is to install Tomcat on localhost:

To do this, we need to copy the mod_jk.dll connector to the C:ServerApache2modules folder and add the following entry in the Apache2 httpd.conf configuration file:

################################################## ######### ## JSP Support ## Copied from Tomcat auto-configuration file ## + added JkMount /*.jsp ajp13 ## + removed Virtual Host IfModule !mod_jk.c> JkWorkersFile "C:/Server/Tomcat 5.5/conf/workers.properties" JkLogFile "C:/Server/Tomcat 5.5/logs/mod_jk.log" JkLogLevel info JkMount /manager ajp13 JkMount /manager/ * ajp13 JkMount /servlets-examples ajp13 JkMount /servlets-examples/ * ajp13 JkMount /jsp-examples ajp13 JkMount /jsp-examples/ * ajp13 JkMount /tomcat-docs ajp13 JkMount /tomcat-docs/ * ajp13 JkMount /webdav ajp13 JkMount /webdav/ * ajp13 JkMount /ajp13 JkMount /*. jsp ajp13

After which you need to restart the Apache2 server.

Let's now check if it works? Open in browser http://localhost/jsp-examples/. And if we see the following, then everything works!

Server configuration

Now we need to put our server in order, let's configure it for ourselves. Open the httpd.conf file, delete everything from there and paste the text there:

# Folder where our web server is installed ServerRoot "C:/Server/Apache2" # Port that our web server listens to Listen 80 # Set SSI for files with the extension shtm, shtml html AddType text/html .shtm .shtml .html AddOutputFilter INCLUDES .shtm .shtml .html # E-mail address of the web server admin (change it to yours) ServerAdmin localhost@localhost # Our server: port ServerName localhost:80 UseCanonicalName Off # Index files, separated by spaces DirectoryIndex index.htm index.html index.shtm index.shtml index.php index.php3 index.php4 index.jsp # Name of the built-in configuration file AccessFileName .htaccess # Let the web server know that we have a PHP interpreter ScriptAlias ​​/php4/ "C:/Server/php4/" Action application /x-httpd-php4 "/php4/php.exe" # Install extensions for PHP scripts AddType application/x-httpd-php4 .php .php3 .php4 .phtm .phtml # The folder where we will put all our html and other files. DocumentRoot "C:/Server/www" PidFile logs/httpd.pid Timeout 300 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 15 HostnameLookups Off # Modules LoadModule access_module modules/mod_access.so LoadModule actions_module modules/mod_actions.so LoadModule alias_module modules/mod_alias.so LoadMo dule asis_module modules/mod_asis.so LoadModule auth_module modules/mod_auth.so LoadModule autoindex_module modules/mod_autoindex.so LoadModule cgi_module modules/mod_cgi.so LoadModule dir_module modules/mod_dir.so LoadModule env_module modules/mod_env.so LoadModule imap_module modules/mod_imap .so LoadModule include_module modules /mod_include.so LoadModule isapi_module modules/mod_isapi.so LoadModule log_config_module modules/mod_log_config.so LoadModule mime_module modules/mod_mime.so LoadModule negotiation_module modules/mod_negotiation.so LoadModule setenvif_module modules/mod_setenvif.so LoadModule userdir_module module s/mod_userdir.so # Deny access to configuration (.htaccess) and password (.htpasswd) files Order allow,deny Deny from all# Database with file types TypesConfig conf/mime.types # Type of all documents - text DefaultType text/plain MIMEMagicFile conf/magic# Error report file ErrorLog logs/error.log # What to write to the report file can take the following values: # debug, info, notice, warn, error, crit, alert, emerg. LogLevel warn # Template for writing a line to the report file LogFormat "%h %l %u %t "%r" %>s %b "%(Referer)i" "%(User-Agent)i"" combined LogFormat "%h %l %u %t "%r" %>s %b" common LogFormat "%(Referer)i -> %U" referer LogFormat "%(User-agent)i" agent # Report file listing all web accesses server CustomLog logs/access.log common ServerTokens Full # Web server signature (On - enabled, Off - disabled, # EMail - show server admin email) ServerSignature On # Virtual folders # For example: # Alias ​​/icons/ "C:/ Server/Apache2/icons/" # By going to http://localhost/icons/ # we will see the contents of the folder C:/Server/Apache2/icons/ Alias ​​/icons/ "C:/Server/Apache2/icons/" AddIconByEncoding (CMP ,/icons/compressed.gif) x-compress x-gzip AddIconByType (TXT,/icons/text.gif) text/ * AddIconByType (IMG,/icons/image2.gif) image/ * AddIconByType (SND,/icons/sound2 .gif) audio/ * AddIconByType (VID,/icons/movie.gif) video/ * # Select icons for various formats AddIcon /icons/binary.gif .bin .exe AddIcon /icons/binhex.gif .hqx AddIcon /icons/ tar.gif .tar AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip AddIcon /icons/a.gif .ps .ai .eps AddIcon /icons/layout.gif .html .shtml .htm .pdf AddIcon /icons/text.gif .txt AddIcon /icons/c.gif .c AddIcon /icons/p.gif .pl .py AddIcon / icons/f.gif .for AddIcon /icons/dvi.gif .dvi AddIcon /icons/uuencoded.gif .uu AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl AddIcon /icons/tex. gif .tex AddIcon /icons/bomb.gif core AddIcon /icons/back.gif .. AddIcon /icons/hand.right.gif README AddIcon /icons/folder.gif ^^DIRECTORY^^ AddIcon /icons/blank.gif ^ ^BLANKICON^^ # Icon for unknown formats DefaultIcon /icons/unknown.gif # If the contents of a folder are displayed, the description files are read: ReadmeName README.html HeaderName HEADER.html # Files to ignore when listing the directory IndexIgnore .?? * *~ *# HEADER* README* RCS CVS *,v *,t AddEncoding x-compress Z AddEncoding x-gzip gz tgz # Our encoding AddDefaultCharset WINDOWS-1251 # "C:/Server/Apache2/cgi-bin" CGI directory -scripts AllowOverride None Options None Order allow,deny Allow from all################################################## ######### ## JSP Support ## Copied from Tomcat auto-configuration file ## + added JkMount / *.jsp ajp13 ## + removed Virtual Host LoadModule jk_module C:/Server/Apache2/modules/mod_jk.dll JkWorkersFile "C:/Server/Tomcat 5.5/conf/workers.properties" JkLogFile "C:/Server/Tomcat 5.5/logs/mod_jk.log" JkLogLevel info JkMount /manager ajp13 JkMount /manager/ * ajp13 JkMount /servlets-examples ajp13 JkMount /servlets-examples/ * ajp13 JkMount /jsp-examples ajp13 JkMount /jsp-examples/ * ajp13 JkMount /tomcat-docs ajp13 JkMount /tomcat-docs/ * ajp13 JkMount /webdav ajp13 JkMount /webdav/ * ajp13 JkMount /ajp13 JkMount /*.jsp ajp13

Save. Reboot the server.

Installing MySQL server

Unpack the mysql-4.1.7-win.zip file and run the Setup.exe file

Greetings, click Next

Here we select Custom, since we need to install all components completely and specify the installation path.

Select all components to install and specify the installation path for C:ServerMySQL Server 4.1. Let's move on.

Ready to begin the installation process? Click Install.

We observe the installation process.

Skip the registration step on MySQL.com.

Check the “Configure MySQL server” option. And we complete the installation process by starting the configuration.

Greetings again.

We choose the standard configuration so as not to confuse our brains at all, then, if you wish, you can try to tinker with the settings.

We indicate that the MySQL server will be launched as a Windows service.

We specify a password for the administrator, let’s say it will be “password”.

Execute and you're done! After which we see the following picture in the lower right corner:

Now let's test our MySQL server. Let's create a file index.php in the www folder with the following content:

Save.

Open http://localhost/index.php in the browser and....

Not so! The error “Client does not support authentication protocol requested by server; consider upgrading MySQL client"

Well, this is a slight incompatibility. . . Applies to MySQL 4.1 new way storing passwords and because of this, all old clients are incompatible with MySQL. What to do?