2

I use Ubuntu 13.10 + nginx (from repos), but I have one problem: I cant see in browser my local index.hmtl (with help nginx).

Install:

sudo apt-get install nginx

Make dirs for my static files

sudo mkdir /opt/nginx/files && sudo mkdir /opt/nginx/img
sudo chown www-data:www-data /opt/nginx/

/opt/nginx$ ls -la

drwxr-xr-x 4 www-data www-data 4096 oct.  31 19:57 .
drwxr-xr-x 8 www-data www-data 4096 oct.  31 19:57 ..
drwxr-xr-x 2 root     root     4096 oct.  31 20:02 files
drwxr-xr-x 2 root     root     4096 oct.  31 19:57 img

in /etc/nginx/nginx.conf

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;

    ##
    # 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/x-javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # nginx-naxsi config
    ##
    # Uncomment it if you installed nginx-naxsi
    ##

    #include /etc/nginx/naxsi_core.rules;

    ##
    # nginx-passenger config
    ##
    # Uncomment it if you installed nginx-passenger
    ##

    #passenger_root /usr;
    #passenger_ruby /usr/bin/ruby;

    ##
    # Virtual Host Configs
    ##

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

    server {
                listen       80;
                server_name  filestorange;
                error_page   404        /404.html;

                #access_log  logs/localhost.access.log  main;

                location / {
                    root   /opt/nginx/files;
                    index  index.html;
                }
                location /404.html {
                root /opt/nginx/files;
        } 
        }
    }   

Then I use

    sudo nginx -s reload
    sudo service nginx restart

But in localhost in browser I see: If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

I need to see my index.html file (its in /opt/nginx/files). How to fix it? Thanks!

1 Answer 1

3

My guess is sudo chown -R www-data:www-data /opt/nginx/

And I do not see your index.html listed anywhere

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .