nginx - basic

nginx has one master process and several worker processes. The main purpose of the master process is to read and evaluate configuration, and maintain worker processes. Worker processes do actual processing of requests. nginx employs event-based model and OS-dependent mechanisms to efficiently distribute requests among worker processes. The number of worker processes is defined in the configuration file and may be fixed for a given configuration or automatically adjusted to the number of available CPU cores

 

 

 

   

The way nginx and its modules work is determined in the configuration file. By default, the configuration file is named nginx.conf and placed in the directory /usr/local/nginx/conf/etc/nginx, or /usr/local/etc/nginx.

  

安装nginx 

 

apt udpate

apt install nginx -y

nginx -v

nginx -V

 

 

 

 

卸载nginx

apt-get remove nginx nginx-common

apt-get purge nginx nginx-common

测试location

 

 

 

 

 

  

 

 

 

 

 

 

 

 

 

 

 

 

 

测试location方法2

 

 

 

 

 

 

 

 

 

最简单的配置:

/etc/nginx/sites-available/default 

 

 

 

 

可以将根路径修改成其他参数,如下:

 

posted @ 2021-10-22 22:46  xman888  阅读(51)  评论(0编辑  收藏  举报