update
This commit is contained in:
parent
91e5dce938
commit
cc98e5dccb
@ -59,10 +59,11 @@ RUN chown -R nginx:nginx /usr/share/nginx/html \
|
||||
&& chown -R nginx:nginx /var/log/nginx \
|
||||
&& chmod -R 755 /var/log/nginx \
|
||||
&& touch /var/run/nginx.pid \
|
||||
&& chown -R nginx:nginx /var/run/nginx.pid
|
||||
&& chown -R nginx:nginx /var/run/nginx.pid \
|
||||
&& chmod -R 755 /etc/nginx/conf.d
|
||||
|
||||
# 使用非root用户运行
|
||||
USER nginx
|
||||
# 使用root用户运行nginx(标准做法)
|
||||
# USER nginx
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
|
||||
12
nginx.conf
12
nginx.conf
@ -1,9 +1,12 @@
|
||||
# 移除 user 指令,因为我们以非 root 用户运行
|
||||
worker_processes auto;
|
||||
pid /var/run/nginx.pid;
|
||||
# 使用标准的nginx配置结构
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
@ -15,7 +18,6 @@ http {
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user