Issues related to applications and software problems
-
exssrerion
- Posts: 3
- Joined: 2015/03/27 13:47:40
Post
by exssrerion » 2015/03/27 13:54:41
Hi
After issue [systemctl start nginx] command. I got below error message.
Job for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details.
And got this error in log file.
[root@localhost nginx]# systemctl status nginx.service
nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled)
Active: failed (Result: exit-code) since Fri 2015-03-27 20:52:56 ICT; 2min 8s ago
Process: 9782 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)
Mar 27 20:52:56 localhost.localdomain systemd[1]: Starting The nginx HTTP and reverse proxy server...
Mar 27 20:52:56 localhost.localdomain nginx[9782]: nginx: [emerg] "user" directive is not allowed here in /etc/nginx/c...onf:1
Mar 27 20:52:56 localhost.localdomain nginx[9782]: nginx: configuration file /etc/nginx/nginx.conf test failed
Mar 27 20:52:56 localhost.localdomain systemd[1]: nginx.service: control process exited, code=exited status=1
Mar 27 20:52:56 localhost.localdomain systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
Mar 27 20:52:56 localhost.localdomain systemd[1]: Unit nginx.service entered failed state.
-
TrevorH
- Site Admin
- Posts: 33220
- Joined: 2009/09/24 10:40:56
- Location: Brighton, UK
Post
by TrevorH » 2015/03/27 14:19:50
Mar 27 20:52:56 localhost.localdomain nginx[9782]: nginx: [emerg] "user" directive is not allowed here in /etc/nginx/c...onf:1
No nginx expert but that looks like a config file error?
-
exssrerion
- Posts: 3
- Joined: 2015/03/27 13:47:40
Post
by exssrerion » 2015/03/27 14:27:16
Here is configuration
Code: Select all
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/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 /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
index index.html index.htm;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
# server {
# listen 80 default_server;
# server_name localhost;
#
# root /usr/share/nginx/html;
#
# #charset koi8-r;
#
# #access_log /var/log/nginx/host.access.log main;
#
# # Load configuration files for the default server block.
# include /etc/nginx/default.d/*.conf;
#
# location / {
# }
#
# # redirect server error pages to the static page /40x.html
# #
# error_page 404 /404.html;
# location = /40x.html {
# }
#
# # redirect server error pages to the static page /50x.html
# #
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
# }
}
-
giulix63
- Posts: 1305
- Joined: 2014/05/14 10:06:37
- Location: UK
Post
by giulix63 » 2015/03/27 15:05:59
I think the error message refers to /etc/nginx/conf.d/default.conf and not /etc/nginx/nginx.conf. Please always use code tags when posting this kind of content.
Root is evil: Do not use root (sudo) to run any of the commands specified in my posts unless explicitly indicated. Please, provide the necessary amount of context to understand your problem/question.
-
TrevorH
- Site Admin
- Posts: 33220
- Joined: 2009/09/24 10:40:56
- Location: Brighton, UK
Post
by TrevorH » 2015/03/27 15:12:42
Adding -l to the systemctl command might help identify the correct file.
-
giulix63
- Posts: 1305
- Joined: 2014/05/14 10:06:37
- Location: UK
Post
by giulix63 » 2015/03/27 15:35:00
I meant this:
Code: Select all
Mar 27 20:52:56 localhost.localdomain nginx[9782]: nginx: [emerg] "user" directive is not allowed here in /etc/nginx/c...onf:1
That seems to point to a file in the conf.d directory, despite the next message referring to nginx.conf. nginx.conf ends with an include directive that includes all .conf files from conf.d. "user" is a valid directive in nginx.conf, but not in default.conf, which is the most probable candidate to have been modified for nginx configuration. And yes, Trevor, you are right: it's systemctl/journalctl truncating the line, not the forums... Still getting used to the systemd ways
Root is evil: Do not use root (sudo) to run any of the commands specified in my posts unless explicitly indicated. Please, provide the necessary amount of context to understand your problem/question.
-
exssrerion
- Posts: 3
- Joined: 2015/03/27 13:47:40
Post
by exssrerion » 2015/03/30 00:55:48
giulix63 wrote:I meant this:
Code: Select all
Mar 27 20:52:56 localhost.localdomain nginx[9782]: nginx: [emerg] "user" directive is not allowed here in /etc/nginx/c...onf:1
That seems to point to a file in the conf.d directory, despite the next message referring to nginx.conf. nginx.conf ends with an include directive that includes all .conf files from conf.d. "user" is a valid directive in nginx.conf, but not in default.conf, which is the most probable candidate to have been modified for nginx configuration. And yes, Trevor, you are right: it's systemctl/journalctl truncating the line, not the forums... Still getting used to the systemd ways
I already change 'user nginx;' to root. But still can't run also.
-
giulix63
- Posts: 1305
- Joined: 2014/05/14 10:06:37
- Location: UK
Post
by giulix63 » 2015/03/30 06:43:20
Please copy contents of
both /etc/nginx/nginx.conf
and /etc/nginx/conf.d/default.conf to
CentOS' Pastebin and post a link here. You may want to anonymize server name and personal information.
P.S. And change root back to nginx. You shouldn't run a web/proxy server as root for security reasons.
Root is evil: Do not use root (sudo) to run any of the commands specified in my posts unless explicitly indicated. Please, provide the necessary amount of context to understand your problem/question.