Nginx - Basic installation and configuration of Nginx under Windows
WBOYOriginal
2016-08-08 09:20:151000browse
Nginx is a lightweight, high-performance Http WebServer written in an event-driven manner. Therefore, compared to Apache, Nginx is more stable, has better performance, is simple to configure, and consumes less resources. 1. Install Nginx Starting from v0.7.52, Nginx has begun to release the Windows version of Nginx. You can download it on its official website: http://nginx.net After downloading, unzip it directly. Yes, unzip it here to the c:nginx directory. 2. Start Nginx Enter the c:nginx directory with the command line, run nginx.exe, and start the console window. Port 80 is enabled by default. Anyone who has used Tomcat hopes to see the startup log in the console, but nginx logs have to check the corresponding log files in the logs directory. 3. Visit the welcome html page Visit http://localhost in the browser, you can see the default welcome page. 4. Stop Nginx Ctrl+C no response . So close the console window. However, accessing http://localhost is still valid. Looking at the process, I found that nginx was not shut down at all. Therefore, if you want to completely shut down nginx, it should be
Command code
nginx -s stop
Please refer to the official documentation nginx/Windows
usage or use the windows taskkill command:
Command code
taskkill /F /IM nginx.exe > nul
5. Ngnix common configuration All configurations of Nginx use the conf/nginx.conf file by default, which is equivalent to the httpd.conf file of apache. When running nginx.exe, nginx -c confnginx.conf is implicitly run. If you want to use a self-defined conf file such as my.conf, the command is nginx -c confmy.conf. Common configurations are as follows:
Nginx .conf code
http {
server {
; Location / {
# 2 . The default homepage directory is in the html subdirectory of the nginx installation directory.
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn