I'm trying to install Oxidized on an Ubuntu 18.04 LTS server. I use Nginx as wab server and at a moment, it is said that I have to modify the file "/etc/nginx/nginx.conf", which I did by correctly following the documentation provided on the github page of the software. But, when I want to run the command sudo nginx -t the server raises this :

nginx: [emerg] "user" directive is not allowed here in /etc/nginx/sites-enabled/nginx.conf:1

So I've already tried to do sudo chown -R /etc/nginx/sites-enabled hoping that this might change anything. Here is my nginx.conf:

user oxidized oxidized;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 768;
        # multi_accept on;

http {

        # Basic Settings

        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;
    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_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/ja$

    # Virtual Host Configs

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

    server {
        listen      80;
        server_name oxidized.test.com www.oxidized.test.com;
        return      301 https://$server_name$request_uri;
        root        /usr/share/nginx/html;

        auth_basic "Restricted Access";
        auth_basic_user_file /etc/nginx/.htpasswd;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {

        error_page 404 /404.html;
            location = /40x.html {

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {

I don't that I did any mistakes but if anybody can help me to find where the problem is, it would be nice. Please answer me as soon as possible.

  • 2
    You said that doc says to modify file /etc/nginx/nginx.conf but the error message is for file /etc/nginx/sites-enabled/nginx.conf. Did you modify the right file ? – krisFR May 16 at 14:53
  • I did because I've created a symbolic link between the file /etc/nginx/nginx.conf and the directory /etc/nginx/sites-enabled by running ln -s /etc/nginx/nginx.conf /etc/nginx/sites-enabled. That's why I don't understand where the problem is. But maybe it isn't enough. So I would like to know what I have forgotten. – Matteo Ould May 17 at 7:55
  • You can't have file nginx.conf in both directories. the user directive should be in the main config file /etc/nginx/nginx.conf and you should not have a nginx.conf file within /etc/nginx/sites-enabled – krisFR May 17 at 10:13
  • The file nginx.conf isn't within /etc/nginx/sites-enabled it is a symbolic link with /etc/nginx/nginx.conf file. Next, I don't know if that's the right to do because the doc that I followed is not really clear to me, I found. Here is the link to the doc as well as the tutorial: github.com/ytti/oxidized fakrul.me/2017/03/08/… . – Matteo Ould May 20 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.