【发布时间】:2015-04-15 15:03:36
【问题描述】:
我无法对要使用的 /etc/nginx/nginx.conf http 块进行任何更改。我从最简单的事情开始——我想将 access.log 的名称修改为其他名称(即 a.log)。这是一个普通的 nginx 安装(还没有自定义配置文件)。以下是我所知道的:
- 更改 nginx.conf 头部的值确实会影响配置(将 worker_processes 4 更改为 worker_processes 2 确实会更改 worker 的数量)
- 在 nginx.conf 的 http 块中出现语法错误确实会导致 nginx 在重启时抛出错误
- 将 access_log 改为 access_log /var/log/nginx/a.log 并不会修改日志的位置,nginx 实际上会继续记录到 /var/log/nginx/access.log
这是我的 nginx.conf 文件的 sn-p:
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/a.log;
#....
}
是否像我修改一个被其他配置文件覆盖的 http 块一样简单?感谢您的帮助。
【问题讨论】:
-
试试“grep -r /var/log/nginx/access.log /etc/nginx”和“grep -r include /etc/nginx”。
-
“香草”安装可能会因您使用的发行版而异,但它可能是像 /etc/nginx/conf.d/default 这样的文件,用于指定默认虚拟主机的工作方式。跨度>
-
"grep -r /var/log/nginx/access.log /etc/nginx" 什么也不返回,"grep -r include /etc/nginx" 返回"/etc/nginx/nginx.conf : 包括 /etc/nginx/mime.types; /etc/nginx/nginx.conf: #include /etc/nginx/naxsi_core.rules; /etc/nginx/nginx.conf: 包括 /etc/nginx/conf.d/ *.conf; /etc/nginx/nginx.conf: 包括 /etc/nginx/sites-enabled/*;"
-
感谢您的意见。这是一个 ubuntu 发行版。 conf.d 中没有文件。
-
也许你有一个 /etc/nginx/sites-enabled/default 文件呢?
标签: nginx