Langues disponibles:existe|en|Ru
Si vous ne savez rien sur le serveur HTTP Apache ou même sur le fonctionnement d'un site Web, vous vous demandez peut-être par où commencer et quelles questions poser. Ce document vous guidera à travers les bases.
Clients, serveurs et URL
Nom d'hôte et DNS
Fichiers de configuration et instructions
contenu du site Web
Fichiers journaux et dépannage
Et maintenant, qu'est-ce qu'on fait ensuite ?
Voir également
- Commentaire
Clients, serveurs et URL
L'adresse d'un site Web sur le Web est représentée par une URL - Uniform Resource Locator - qui comprend un protocole tel queURL
), nom du serveur (par exemplewww.apache.org
), mettre (npr/docs/current/getting-started.html
), et un tableau de paramètres (chaîne de requête) si nécessaire (par exempleparamètre = valeur
) pour transférer des informations supplémentaires au serveur.
Un client (tel qu'un navigateur Web) se connecte à un serveur (tel que le serveur Apache HTTP) à l'aide d'un protocole spécifique et exécuteje vous en prieObtenez la ressource en spécifiant le chemin.
Un chemin peut représenter différents types de ressources sur le serveur. Il peut s'agir d'un fichier (par exempledébut du travail-start.html
), gestionnaire (commeétat du serveur), ou tout type de programme tel queindice php
Nous décrivons tout cela plus en détail dans les sections suivantescontenu du site Web.
Le serveur envoie alors unrépondreIl comprend un code d'état et un corps de réponse facultatif. Le code d'état indique si la demande a été traitée avec succès et, si ce n'est pas le cas, quel type d'erreur s'est produit. Le client doit alors savoir quoi faire de la réponse. Vous pouvez regarderServeur wiki Apache HTTP.
Les détails de la transaction et toutes les erreurs qui se sont produites sont enregistrés dans les fichiers journaux. Tout cela est décrit en détail dans les sections suivantesDébogage et journaux.
Nom d'hôte et DNS
Pour se connecter à un serveur, un client doit d'abord traduire le nom du serveur en une adresse IP, qui peut localiser le serveur sur Internet. Par conséquent, pour que votre serveur Web soit joignable, son nom doit être enregistré dans le DNS.
Si vous ne savez pas comment effectuer cet enregistrement, vous devez contacter votre administrateur réseau ou votre fournisseur de services Internet afin qu'ils puissent le faire pour vous.
Plusieurs noms d'hôte peuvent pointer vers la même adresse IP, plusieurs adresses IP peuvent être connectées au même serveur physique, ainsi plusieurs serveurs Web peuvent être hébergés sur le même serveur physique grâce àserveur virtuel.
Pour vérifier un serveur qui n'est pas disponible sur Internet, vous pouvez entrer son nom d'hôte dans le fichier hosts pour effectuer une résolution de nom locale. Par exemple, pour tester un serveur Webwww.exemple.com
Depuis le serveur physique sur lequel il se trouve, vous pouvez ajouter la ligne suivante au fichier hosts de ce dernier :
127.0.0.1 www.exemple.com
Généralement, le fichier hosts se trouve dans un répertoire/ETC
Sur les systèmes de type Unix ouC:\Windows\system32\driver\etc
ce sont des fenêtres.
Plus de détails sur le fichier hosts peuvent être trouvés àWikipédia.org/wiki/Hosts_ (documentation)et les informations DNSWikipedia.org/wiki/Domain_Name_System.
Fichiers de configuration et instructions
La configuration du serveur HTTP Apache se fait via de simples fichiers texte. Ces fichiers peuvent se trouver dans de nombreux emplacements différents, selon la façon dont le serveur a été installé. Vous pouvez trouver l'emplacement actuel de ces fichiers surwiki httpdSi vous avez installé httpd à partir des sources, le répertoire par défaut des fichiers de configuration est/usr/local/apache2/conf
.Le nom du fichier de configuration par défaut est généralementfichier de configuration httpd
, mais peut également varier selon la distribution du serveur tiers.
L'ensemble de la configuration est généralement découpé en plusieurs fichiers pour une gestion plus aisée. Ces fichiers sont inclus dans le fichier de configuration principal via une directiveinclure
.Les noms ou emplacements de ces fichiers ne sont pas fixes et peuvent varier considérablement d'une distribution à l'autre. Disposez-les et divisez-les comme vous le souhaitezvosGoût et besoins, quitte à changer l'organisation par défaut.
Le serveur est configuré viainstructions de configurationEntrez dans le fichier de paramètres. Une directive se compose d'un mot-clé et d'un ou plusieurs paramètres qui spécifient sa valeur.
Répondre"Où mettre cette directive ?" dépend généralement du niveau auquel la directive doit être considérée. Si elle est globale, elle doit être placée dans le fichier de configuration principal et en dehors de tout module
,
,
, ou tout autre endroit. Par exemple, s'il ne fait référence qu'à un répertoire spécifique, il doit être placé dans une section
référencé dans ce répertoire. voir la documentationdégradation partiellePlus de détails.
En plus du fichier de configuration principal, certaines directives peuvent être insérées dans le fichier.htaccess
directement dans le répertoire correspondant. document.htaccess
Principalement destiné aux personnes n'ayant pas accès aux fichiers de configuration du serveur. Vous trouverez plus de détails sur ces fichiers.htaccess
dans ce.htaccessshowto.
contenu du site Web
Bien que le contenu d'un site Web puisse prendre de nombreuses formes, il en existe deux types principaux : le contenu statique et le contenu dynamique.
Des exemples de contenu statique sont les fichiers HTML, les images, les fichiers CSS et tout autre fichier trouvé dans le système de fichiers. mandatracine du document
Permet de spécifier l'emplacement dans l'arborescence du site où ces fichiers doivent être placés. Cette directive peut être définie globalement ou par niveau de serveur virtuel. Vous pouvez consulter votre fichier de configuration pour vérifier comment cette directive est définie pour votre serveur.
Généralement, si aucun nom de fichier n'est spécifié dans la requête, la page de nomindex.html
Bonjour. Par exemple, si la directiveracine du document
est réglé sur/var/www/html
, si la demande est une adressehttp://www.example.com/posao/
, c'est un fichier/var/www/html/work/index.html
Le serveur l'enverra au client.
Le contenu dynamique est un contenu généré au moment du traitement de la demande et peut varier d'une demande à l'autre. Ce contenu dynamique peut être créé de plusieurs façonsgestionnaire de contenuou "opérateur". peut également créerProgramme CGICréez du contenu pour votre site Web.
Enfin, vous pouvez utiliser des modules tiers comme mod_php pour écrire du code pour beaucoup de choses. De nombreuses applications tierces écrites dans différents langages ou outils sont disponibles en téléchargement et peuvent être installées sur le serveur HTTP Apache. La prise en charge de ces applications n'entre pas dans le cadre de ce document et vous êtes invité à visiter le site Web de leur éditeur pour accéder à leur documentation.
Fichiers journaux et dépannage
En tant qu'administrateur de serveur Apache HTTP, votre principale source d'informations est constituée par les fichiers journaux, en particulier le journal des erreurs. Essayer de dépanner sans vérifier le journal des erreurs revient à essayer de conduire les yeux fermés.
L'emplacement du journal des erreurs dans le système de fichiers est déterminé par la directivefichier journal des erreurs
Il peut être défini globalement ou par niveau de serveur virtuel. Chaque entrée du journal des erreurs vous indiquera quels étaient les problèmes et quand ils se sont produits. Il vous indique également généralement comment résoudre le problème. Chaque message d'erreur comprend un code d'erreur que vous pouvez utiliser pour rechercher sur Internet des instructions plus détaillées sur la façon de résoudre le problème. Vous pouvez également configurer la journalisation des erreurs pour enregistrer un ID d'erreur, que vous pouvez ensuite mettre en corrélation avec les journaux d'accès pour déterminer quelle demande a provoqué l'erreur.
tu seras deboutDocumentation du journal.
Et maintenant, qu'est-ce qu'on fait ensuite ?
Une fois les prérequis remplis, il est temps de passer aux choses sérieuses.
Ce document ne couvre que les bases. Nous espérons que cela vous aidera à démarrer, mais il y a encore beaucoup de choses que vous devez savoir.
- Telecharger des fichiers
- Mise en place
- configuration
- démarrer le serveur
- Questions fréquentes
FAQs
How to enable HTTP 2 Apache? ›
- Disable the mpm_prefork module, which is not compatible with HTTP/2. ...
- Enable the mpm_event module. ...
- Enable the ssl module. ...
- Enable the http2 module to activate HTTP/2 support. ...
- Restart Apache to apply all the changes. ...
- Verify Apache is still active using the systemctl status command.
- Sematext Monitoring.
- Nagios.
- Zabbix.
- SolarWinds Server and Application Monitor.
- Datadog's Apache Monitor.
- Dynatrace.
- AppDynamics.
- ManageEngine Applications Manager.
You can use the “apachectl” command to get the version of Apache running on your server. To do this, open a terminal window and type the following command: apachectl -v This will output the version of Apache running on your server. You can also use the “httpd” command to get the version of Apache.
How to enable HTTP 2 in Apache Windows? ›- Take a backup of httpd.conf file (default location /etc/httpd/conf/httpd.conf)
- Open the httpd. conf file with vi and ensure the following exists; if not, then add it.
Google Chrome offers a quick and easy way to check if HTTP/2 is supported on your SSL-enabled site. First, visit your site in Chrome over HTTPS. There you'll see your site listed with protocol h2, confirming your site works over HTTP/2.
How to configure Apache 2 server? ›- Installing Apache. To install Apache, install the latest meta-package apache2 by running: sudo apt update sudo apt install apache2. ...
- Creating Your Own Website. By default, Apache comes with a basic site (the one that we saw in the previous step) enabled. ...
- Setting up the VirtualHost Configuration File.
Apache web server exposes metrics through its status module, mod_status. If your server is running and mod_status is enabled, your server's status page should be available at http://192.0.2.0/server-status . If that link does not work, it means you need to enable mod_status in your configuration file.
How to check Apache server load? ›Checking Apache Server Uptime using mod_status Module. Apache web server comes with a built-in module called mod_status that can be used to display status of Apache server in real-time. mod_status module displays information such as uptime, total accesses, CPU usage, and other important details about Apache server.
How do I troubleshoot Apache server? ›- Check Apache Configuration. The first step in troubleshooting Apache web server in Linux is to check the configuration. ...
- Check Log Files. ...
- Check Apache Processes. ...
- Check Network Connections. ...
- Check Firewall Rules. ...
- Check System Resources. ...
- Check Apache Modules. ...
- Check System Services.
It is the most popular web server in the world, powering over 40% of all websites. The current version of Apache Web Server is Apache 2.4, which was released in February 2012. Apache 2.4 offers a number of improvements over its predecessor, Apache 2.2, including better performance, improved security, and more features.
What is the latest version of Apache HTTP Server? ›
Apache Web Server is one of the most popular web servers in the world. It is an open-source software that is used to host websites and web applications. The latest version of Apache Web Server is Apache 2.4. 46, which was released in April 2021.
How do I access the Apache HTTP Server? ›You can use a web browser or an FTP client to access the server. If you are using a web browser, you can enter the IP address of the server in the address bar. If you are using an FTP client, you can enter the IP address, username, and password to connect to the server.
How to install Apache HTTP server on Windows Server? ›- Download the installation media in the form of a ZIP file.
- Extract the contents of the Apache Web Server 2.4 zip to the file system.
- Locate the extracted Apache24 folder and copy this folder to the root of C:\
- Open the C:\Apache24\bin folder and run the httpd.exe command.
- Step 1: Download Apache Web Server. The first step is to download Apache Web Server. ...
- Step 2: Install Apache Web Server. ...
- Step 3: Configure Apache Web Server. ...
- Step 4: Start Apache Web Server. ...
- Step 5: Test Apache Web Server. ...
- Step 6: Troubleshoot Apache Web Server.
Enable the site
The output of the command is as follows: Site domain1.com installed; run /etc/init. d/apache2 reload to enable.
Today, all popular browsers already support HTTP/2 technology. In order for your site to load via this protocol, no special changes need to be made. Make sure that SSL certificate is already installed on your site and ask your hosting provider if your server supports the updated HTTP protocol.
How do I know if HTTP 2 is enabled on Windows Server? ›Launch your browser from your Windows 10 or Windows Server 2016 machine and hit F12, (or go to Settings and enable F12 Developer Tools), and then switch to the Network tab. Browse to https://localhost and voila, you are on HTTP/2!
How do I test my HTTP connection? ›- Open a command prompt.
- Type telnet <http server> <port>, where <http server> is the name or IP address of the http server to test and <port> is the port number the HTTP server is using. ...
- If the connection is successful, you will see a blank screen waiting for input.
The data for websites you'll run with Apache is located in /var/www by default, but you can change that if you want.
How to setup Apache web server IP address? ›- Check the Current IP Address. Before changing the IP address of an Apache web server, it is important to check the current IP address. ...
- Open the Apache Configuration File. ...
- Edit the Listen Directive. ...
- Restart the Apache Service. ...
- Verify the Changes. ...
- Conclusion.
How to host two websites on one Apache server? ›
- Create the Directory Structure. The directory structure stores the site data. ...
- Set Up Permissions. ...
- Set up an Index Page. ...
- Copy the Config File for Each Site. ...
- Edit the Config File for Each Site. ...
- Enable the Config File. ...
- Test / Verify Apache Configurations.
Apache monitoring proactively measures key web server performance metrics, such as server uptime, idle workers, traffic, and server requests per second. With this information, you can more quickly pinpoint and troubleshoot issues capable of affecting system functioning or end-user experience.
How to check Apache thread count? ›The threads usage can be monitored. To monitor, start the Administrative instance, select the HTTP server in question, and select Real Time Server Statistics at the bottom left.
How to check cache in Apache? ›- check size of /var/cache directory. It should be growing in size after some time when there is hit on your apache.
- You can check in logs, there should response code 302 instead of 200.
Check if Apache is running on Windows
On Windows, you can use Task Manager to see if the Apache process is active. After pressing Ctrl + Shift + Esc, start typing either "httpd.exe" or "apache.exe" and see if they appear on the list. If they do, then Apache is running.
- Enable mod_status. Apache configuration file is located at one of the following locations, depending on your Linux distribution. ...
- Configure mod_status. ...
- Enable Extended Status. ...
- Restart Apache Web Server. ...
- Verify Server Status. ...
- Enable Auto Refresh.
You can access Apache logs from var/log/log_type. For example, you can access Apache logs from the Apache Unix/Linux server by looking in the following directories: /var/log/apache/access. log.
How do I manually start Apache server? ›- Restart Apache 2 web server, enter: # /etc/init.d/apache2 restart. $ sudo /etc/init.d/apache2 restart. ...
- To stop Apache 2 web server, enter: # /etc/init.d/apache2 stop. ...
- To start Apache 2 web server, enter: # /etc/init.d/apache2 start.
- Perform an assessment of the network structure and layout.
- Confirm your TCP/IP settings are correctly configured.
- Rule out WAN and LAN connection issues.
- Evaluate the compatibility of server applications with the operating system.
To restart the Apache web server, the user should open a terminal window and log in as the root user. Once logged in, the user should enter the command ¡°systemctl restart apache2¡±. This command will restart the Apache web server. After the command is entered, the user should wait for the server to restart.
Is Apache 2.4 still supported? ›
According to Red Hat's site, Apache httpd 2.4 is supported until 2024. Where can I find the support enddate for 2.2? : r/redhat.
Is Apache 2.4 6 latest version? ›The current latest release for Apache httpd is version 2.4. 46. However, this is more of a minor update with a small handful of security updates addressing CVE-2020-11984, CVE-2020-11993, and slight modifications to mod_http2. The last major release of Apache server was 2.4 and that was close to a decade ago.
Is Apache web server and Apache HTTP server same? ›What is Apache Web Server? Apache HTTP Server is a free and open-source web server that delivers web content through the internet. It is commonly referred to as Apache and after development, it quickly became the most popular HTTP client on the web.
Is Apache HTTP Server still used? ›Yes, Apache web server is still widely used today and is a popular choice for many web hosting companies. It is a reliable and secure web server that is used by millions of websites and web applications.
Which Apache version is best? ›Apache httpd 2.4.57 Released 2023-04-06
This latest release from the 2.4.x stable branch represents the best available version of Apache HTTP Server.
- Back Up Configuration Files. ...
- Download the Latest Version of Apache. ...
- Uninstall the Old Version. ...
- Install the New Version. ...
- Test the Server. ...
- Update the Server Regularly. ...
- Conclusion.
Run the command line/terminal and cd to the folder with your index. html file, then: Execute http-server. HTTP-server will start serving files from your current directory.
Where is Apache HTTP server located? ›For example, in a default install, Apache httpd resides at /usr/local/apache2 in the Unix filesystem or "c:/Program Files/Apache Group/Apache2" in the Windows filesystem. (Note that forward slashes should always be used as the path separator in Apache httpd configuration files, even for Windows.)
Where is Apache HTTP server config? ›The Apache HTTP Server configuration file is /etc/httpd/conf/httpd.
How do I enable http2 in my browser? ›In the menu, click Settings > Active Profile > Web (Protocol Level). HTTP/2 is disabled by default. To enable it, set the Preferred HTTP version to HTTP/2 . Note: Make sure you select a Browser that supports HTTP/2.
How to use HTTP 2 on localhost? ›
Launch your browser from your Windows 10 or Windows Server 2016 machine and hit F12, (or go to Settings and enable F12 Developer Tools), and then switch to the Network tab. Browse to https://localhost and voila, you are on HTTP/2!
How do I enable HTTP services? ›- Buy an SSL certificate.
- Request the SSL certificate.
- Install the certificate.
- Update your site to enable HTTPS.
- Install the Apache server and the required packages. ...
- Enable Apache module named: Mod_ssl. ...
- Edit the Apache configuration file. ...
- Add the following lines at the end of this file. ...
- Create a private key and the website certificate using the OpenSSL command. ...
- Enter the requested information.
HTTP/2 in Apache httpd
The HTTP/2 protocol is implemented by its own httpd module, aptly named mod_http2 . It implements the complete set of features described by RFC 7540 and supports HTTP/2 over cleartext (http:), as well as secure (https:) connections. The cleartext variant is named ' h2c ', the secure one ' h2 '.
HTTP/2 protocol on Chrome is fully supported on 41-114, partially supported on None of the versions, and not supported on 4-40 Chrome versions. HTTP/2 protocol on Safari is fully supported on 11-16.4, partially supported on 9.1-10.1, and not supported on 3.2-8 Safari versions.
Why is http 2 not working in Chrome? ›If you're making searches with an outdated browser, this can easily lead to an HTTP/2 protocol error. This is because your browser's data packets are incompatible with the site you're trying to load. To fix this problem, you can update your browser.
How do I enable HTTP 2 in Chrome? ›Go to the chrome://flags page (I can't link to it directly, as the browser won't allow direct links to the settings page) in your Chrome browser. Search for HTTP/2. Find the option called Enable SPDY/4. Next, restart Chrome and SPDY4 will be enabled.
How do I know if tls1 2 is enabled on my server? ›How to check if TLS 1.2 is enabled? If the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client\DisabledByDefault is present, the value should be 0.
How do I know if tls1 2 is enabled? ›-Press the Windows key + R to start Run, type regedit, and press Enter or click OK. -If you can't find any of the keys or if their values are not correct, then TLS 1.2 is not enabled.
How do I enable TLS on Apache? ›- Login to Apache HTTP server and take a backup or ssl.conf file or where you have SSL configuration.
- Locate SSLProtocol line and add +TLSv1.3 at the end of the line.
How to install local HTTP server? ›
Installing HTTP server using NPM
Run the command line/terminal on your system (it doesn't matter which directory you are currently in). Execute npm install -g http-server . Once NPM finishes, you have the tiny HTTP-server installed. That's it.
Open https://localhost or https://mysite.example in your browser: you're running your site locally with HTTPS. You won't see any browser warnings, because your browser trusts mkcert as a local certificate authority. Your server may use a different port for HTTPS.
How to start a server on localhost? ›- Access a terminal for Debian and Ubuntu/Ubuntu-based distro and enter the command: sudo apt install apache2. • For CentOS and Red Hat, enter the command: ...
- To confirm the installation was successful enter “ localhost ” or “ 127.0. 0.1 ” into your web browser. •