Note : Cet article a été publié à l’origine en 2014. Certains étapes, commandes ou versions de logiciels ont pu changer. Consultez la documentation actuelle de NginX pour les informations les plus récentes.
In this step-by-step guide, you’ll learn reload your nginx configuration. Nginx is a high-performance HTTP server and reverse proxy, known for its stability, rich feature set, and low resource consumption.
Prérequis
Avant de commencer, assurez-vous d’avoir :
- A Linux server with Nginx installed
- Root or sudo access to the server
- Basic understanding of web server configuration
How to: Reload your (</nginx/> “What is: NginX”) Configuration
Sometimes when working with NginX you come across the need to reload your configuration for the changes made to your .conf files take place. Although this is a simple task some considerations and best practices should be followed for optimal results:
- Verify that your configuration files “compile”. Executenginx -t to test that the .conf files are well formatted, the syntax is correct and the directives were allowed. If you don’t do this and try to reload the configuration it would either result on no configuration to be loaded or your previous configuration to remain there and hence the changes you made are not applied.
- Run service nginx reload or**/etc/init.d/nginx reload**
What this is going to do is effectively reload your configuration. Worker processes that are active will keep the old configuration until they become free while available ones will stop and restart with the new configuration. This is a very smooth way to make a change to the configuration without having some downtime from restarting the NginX server. As mentioned above ALWAYS check the configuration files at least load. If you did a service stop you couldn’t start back up until you had fixed the issues in your configuration files and that could result in significant downtime.
(http://img.zemanta.com/zemified_h.png?x-id=86554271-7430-4aa1-bedc-2365e5767803)](http://www.zemanta.com/?px “Enhanced by Zemanta”)
Résumé
You’ve successfully learned reload your nginx configuration. If you run into any issues, double-check the prerequisites and ensure your NginX environment is properly configured.