我的一部分/etc/nginx/nginx.conf
#user nobody;
user http;
worker_processes 1;
events {
worker_connections 1024;
}
#.......
我的网站之一:
ls -al /var/web/site123.com/index.html
-rw-r--r-- 1 root root 761 Jul 3 07:31 /var/web/site123.com/index.html
ls -ald /var/web/site123.com
drwxr-xr-x 2 root root 4096 Jul 3 07:31 /var/web/site123.com
鉴于网站的目录index.html
也属于root
,那么 nginx 是如何工作和服务于网站的呢?nginx worker 在http
用户下运行,网站可以通过互联网访问。
root 873848 0.0 0.0 22392 1436 ? Ss 07:27 0:00 nginx: master process /usr/bin/nginx -g pid /run/nginx.pid; error_log stderr;
http 873849 0.0 0.2 22396 4264 ? S 07:27 0:00 nginx: worker process
该用户如何访问仅应允许访问http
的路径?root