Question

Nginx shows failed. I can't start it, neither other command.

Get cloud support with Ubuntu Advantage Cloud Guest: http://www.ubuntu.com/business/services/cloud

5 packages can be updated. 0 updates are security updates.

Last login: Mon Jan 22 11:23:45 2018 /usr/bin/xauth: file /home/marcelo/.Xauthority does not exist root@ubuntu-s-1vcpu-1gb-nyc3-01:~$ systemctl status nginx ● nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Mon 2018-01-22 12:06:06 UTC; 53s ago Process: 1361 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Subscribe
Share

user www-data; worker_processes auto; pid /run/nginx.pid;

events { worker_connections 768; # multi_accept on; }

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    ##

    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

}

Follow the path on my Droplet:

/var/log/nginx/error.log

2018/01/22 00:30:52 [emerg] 3686#3686: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:37 2018/01/22 00:32:21 [emerg] 3697#3697: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:37 2018/01/22 00:32:41 [emerg] 3705#3705: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:37 2018/01/22 00:32:58 [emerg] 3713#3713: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:37 2018/01/22 00:33:27 [emerg] 3725#3725: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:37 2018/01/22 00:36:44 [emerg] 3744#3744: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:37 2018/01/22 00:39:03 [emerg] 3796#3796: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:37 2018/01/22 00:39:31 [emerg] 3805#3805: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:37 2018/01/22 00:49:35 [emerg] 3834#3834: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:37 2018/01/22 00:52:08 [emerg] 3982#3982: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:37 2018/01/22 00:55:59 [emerg] 4071#4071: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:37 2018/01/22 00:58:03 [emerg] 4089#4089: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:37 2018/01/22 01:02:38 [emerg] 4107#4107: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:37 2018/01/22 01:02:48 [emerg] 4116#4116: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:37 2018/01/22 01:03:09 [emerg] 4195#4195: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:37 2018/01/22 01:11:34 [emerg] 4256#4256: invalid parameter “104.236.56.190” in /etc/nginx/sites-enabled/default:18 2018/01/22 01:11:51 [emerg] 4337#4337: invalid parameter “104.236.56.190” in /etc/nginx/sites-enabled/default:18 2018/01/22 01:18:04 [emerg] 4359#4359: invalid parameter “104.236.56.190” in /etc/nginx/sites-enabled/default:18 2018/01/22 01:22:36 [emerg] 4375#4375: invalid parameter “104.236.56.190” in /etc/nginx/sites-enabled/default:18 2018/01/22 01:25:28 [emerg] 4394#4394: invalid parameter “104.236.56.190” in /etc/nginx/sites-enabled/default:18 2018/01/22 01:26:11 [emerg] 4410#4410: invalid parameter “local_host” in /etc/nginx/sites-enabled/default:18 2018/01/22 01:27:01 [emerg] 4425#4425: unknown directive “access_log/var/log/nginx/localhost_access.log” in /etc/nginx/sites-e$ 2018/01/22 11:23:26 [emerg] 1375#1375: unknown directive “default_server” in /etc/nginx/sites-enabled/default:42 2018/01/22 11:26:24 [emerg] 1758#1758: unknown directive “default_server” in /etc/nginx/sites-enabled/default:42 2018/01/22 12:06:06 [emerg] 1361#1361: unknown directive “default_server” in /etc/nginx/sites-enabled/default:42 2018/01/22 12:53:00 [emerg] 1401#1401: unknown directive “default_server” in /etc/nginx/sites-enabled/default:42 2018/01/23 12:57:46 [emerg] 1354#1354: unknown directive “default_server” in /etc/nginx/sites-enabled/default:42 2018/01/23 14:14:19 [emerg] 8712#8712: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 14:15:16 [emerg] 8745#8745: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 14:40:08 [emerg] 9067#9067: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 14:48:12 [emerg] 9101#9101: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 14:49:26 [emerg] 9122#9122: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 15:07:03 [emerg] 9330#9330: “worker_processes” directive is not allowed here in /etc/nginx/nginx.conf:6 2018/01/23 15:44:43 [emerg] 1382#1382: “worker_processes” directive is not allowed here in /etc/nginx/nginx.conf:6 2018/01/23 16:43:59 [emerg] 1386#1386: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 17:05:05 [emerg] 1859#1859: unknown directive “marcelo/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 17:07:59 [emerg] 1881#1881: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 17:20:59 [emerg] 1956#1956: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 17:23:53 [emerg] 2014#2014: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 17:32:20 [emerg] 2049#2049: unknown directive “/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 17:33:28 [emerg] 2069#2069: unknown directive “./usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 17:34:33 [emerg] 2087#2087: unknown directive “./usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 17:41:42 [emerg] 2151#2151: unknown directive “./usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 17:41:50 [emerg] 2166#2166: unknown directive “./usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 17:54:59 [emerg] 2333#2333: unknown directive “./usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 17:55:23 [emerg] 2352#2352: unknown directive “./usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 18:00:06 [emerg] 2436#2436: unknown directive “./usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 18:04:59 [emerg] 2515#2515: unknown directive “./usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 18:18:45 [emerg] 2606#2606: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/23 19:59:09 [emerg] 1365#1365: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38 2018/01/24 00:39:09 [emerg] 1362#1362: unknown directive “root/usr/share/nginx/html” in /etc/nginx/sites-enabled/default:38

root@ubuntu-s-1vcpu-1gb-nyc3-01:~$ nginx -t nginx: [alert] could not open error log file: open() “/var/log/nginx/error.log” failed (13: Permission denied) 2018/01/23 15:45:33 [warn] 1703#1703: the “user” directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1 2018/01/23 15:45:33 [emerg] 1703#1703: “worker_processes” directive is not allowed here in /etc/nginx/nginx.conf:6 nginx: configuration file /etc/nginx/nginx.conf test failed


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Based on what you shared my best guess is that your log files in /var/log/nginx have the incorrect ownership. If the ownership of these files were changed to root you would likely see nginx fail in this way (being unable to open the logs) but you would still be able to view your log files since you are logged in as root.