0 nginx
我在一个共享主机上,有权继承 nginx 根安装并覆盖它的配置文件(注意:我不想在我的主目录中编译我自己的 nginx)。
我写了一个启动/重新加载/停止脚本,它运行良好,但是我不断收到以下错误
启动脚本
#!/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"
...
Run Code Online (Sandbox Code Playgroud)
我的配置:
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;
...
Run Code Online (Sandbox Code Playgroud)
错误:
Reloading nginx configuration: [alert]: could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (13: Permission denied)
nginx.
Run Code Online (Sandbox Code Playgroud)
所以它似乎没有正确读取我的错误和访问日志位置,我该如何解决这个问题,谢谢!