首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Nginx许可13

问Nginx许可13
EN

Server Fault用户
提问于 2011-09-07 10:18:17
回答 2查看 5.5K关注 0票数 1

我在一个共享主机上,有权继承nginx根安装并重写它的配置文件(注意:我不想在我的主目录中编译我自己的nginx )。

我编写了一个开始/重新加载/停止脚本,这个脚本工作得很好,但是我一直在下面看到错误

启动脚本

代码语言:javascript
复制
#!/bin/bash

# Set this to your nginx configuration file and PID

CONFIG=~/nginx/nginx.conf
PIDFILE=~/nginx/nginx.pid


# Do not change anything below unless you know what you do

DAEMON=/usr/local/nginx/sbin/nginx
NAME="nginx"
PATH=/sbin:/bin:/usr/sbin:/usr/bin
OPTS="-c $CONFIG"

...

My config:

代码语言:javascript
复制
worker_processes  4;

error_log  /home/myusername/nginx/error.log;
pid        /home/myusername/nginx/nginx.pid;

events {
    worker_connections  8192;
    multi_accept on;
    use epoll;
}

http {
    error_log /home/myusername/nginx/error.log;
    access_log /home/myusername/nginx/access.log;
    server_names_hash_max_size 8192;
    server_names_hash_bucket_size 128;
    include       /etc/nginx/mime.types;
    underscores_in_headers on;
...

错误:

代码语言:javascript
复制
Reloading nginx configuration: [alert]: could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (13: Permission denied)
nginx.

因此,它似乎没有读取我的错误和访问日志位置正确,我如何解决这个问题,谢谢!

EN

回答 2

Server Fault用户

发布于 2011-12-07 08:57:14

NGINX在读取配置文件之前搜索内置错误日志位置。

您可以在这里找到这个:http://wiki.nginx.org/CoreModule,在error_log部分下。

“还请注意,从0.7.53版本开始,nginx将使用已编译的默认错误日志位置,直到它读取了配置文件。如果运行nginx的用户没有此日志位置的写权限,nginx将引发如下警报:

警报:无法打开错误日志文件: open() "/var/ log /nginx/error.log“失败(13:权限被拒绝)

票数 7
EN

Server Fault用户

发布于 2012-06-22 23:06:47

我已经能够使用-p选项使其工作,将前缀设置为我可以写入的路径。

代码语言:javascript
复制
$ nginx -p . -c my-nginx.conf
票数 3
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/308890

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档