0
然而,开始nginx的失败,我的日志显示:为什么nginx无法启动?
[emerg] 55#55: "server" directive is not allowed here in /etc/nginx/nginx.conf:1
我在做什么错?不知道它是否重要,但这是在码头集装箱内。
然而,开始nginx的失败,我的日志显示:为什么nginx无法启动?
[emerg] 55#55: "server" directive is not allowed here in /etc/nginx/nginx.conf:1
我在做什么错?不知道它是否重要,但这是在码头集装箱内。
/etc/nginx/nginx.conf
是不是存储您的服务器设置的地方。这个文件应该包含它将运行的用户信息和其他全局设置。通常,它将包含这样的东西:
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
client_max_body_size 500M;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
你应该把你的个人服务器设置,在/etc/nginx/sites-enabled/
。如您所见,该文件夹内的所有文件都包含在nginx.conf
文件的http
块中。
因此,将您发布在/etc/nginx/sites-enabled/some-random-name.conf
之内的示例配置存储下来,并将nginx.conf
文件恢复到我上面发布的配置中,例如,您应该很好。
没有看到你的配置就说不出话了......可能与你的服务器指令有关,在错误的地方。 – Brad