FreeBSD nginx.pid权限被拒绝
在FreeBSD 11.0_版本上重新安装nginx。默认nginx.conf,带有一个注释pid的mod。请参阅下面的配置文件。错误:FreeBSD nginx.pid权限被拒绝,nginx,freebsd,Nginx,Freebsd,在FreeBSD 11.0_版本上重新安装nginx。默认nginx.conf,带有一个注释pid的mod。请参阅下面的配置文件。错误: nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok nginx: [emerg] open() "/var/run/nginx.pid" failed (13: Permission denied) nginx: configuration file /usr/l
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: [emerg] open() "/var/run/nginx.pid" failed (13: Permission denied)
nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed
默认nginx.conf:
# user nobody;
worker_processes 1;
# This default error log path is compiled-in to make sure configuration parsing
# errors are logged somewhere, especially during unattended boot when stderr
# isn't normally logged anywhere. This path will be touched on every nginx
# start regardless of error log location configured here. See
# https://trac.nginx.org/nginx/ticket/147 for more info.
#
#error_log /var/log/nginx/error.log;
#
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/local/www/nginx;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
我试图让一个基本的设置工作,但nginx不会通过测试,也不会启动。我期待着它的开始,自然。我的问题是“我如何解决这个问题?”我以前从未在FreeBSD或任何其他操作系统上遇到过这个问题
pid被注释掉,因为
rc.d
已经指向pid,如错误所示。该位置没有永久的nginx.pid
文件 安装Nginx后,请执行以下操作:
sysrc nginx_enable="YES"
然后启动服务
service nginx start
或
这可能也会起作用:
service nginx configtest
默认情况下,pid位于/var/run/nginx.pid
稍后您可以执行以下操作:
nginx -t
或
并且应该可以打印出任何错误。还尝试了用户身份
root
,组admin
。在FreeBSD中,默认情况下没有组管理员,您更改了什么吗?没有,我说我试过了。出于某种原因,它现在正在为http服务,但给了我同样的错误。我试着改成root::admin来回避权限问题。结果它是今天下午自己开始的。即使重新启动了几次,我也看不到它在工作。如果nginx\u enable=YES
已经在那里,并且服务nginx start
不起作用。因此,它取得了进展。谢谢。请尝试删除它,稍后安装pkg安装nginx-lite
应该可以开箱即用。这样做了。甚至尝试安装nginx full,然后返回nginx。使用端口。我从来没有见过服务,也没有见过pid文件,还有这些错误。我将进一步介绍。重新安装了完整的操作系统11.1-RC1,并使默认的nginx.conf
正常工作。然后替换服务器指针,得到nginx.pid
权限错误。重新安装了默认的nginx.conf
,权限问题仍然存在。对于服务器指针,您是什么意思,请同时检查nginx-V
的输出以查看完整路径
nginx -t
nginx -T