二、修改用户和组
vim /usr/local/nginx/conf/nginx.conf
user root root; #取消注释,修改用户为root,组为root
systemctl restart nginx
ps aux | grep nginx
主进程由root创建,子进程由nginx创建
vim /usr/local/nginx/conf/nginx.conf
http {
......
server {
......
location / {
root HTML;
index index.html index.htm;
}
location ~ \.(gif|jpg|jpeg|png|bmp|ico)$ { #加入新的 location,以图片作为缓存对象
root html;
expires 1d; #指定缓存时间,1天
}
......
}
}
systemctl restart nginx