Nginx: не могу увидеть индекс HTML

Я использую Ubuntu 13.10 + nginx (из репозитория), но у меня есть одна проблема: я не вижу в браузере свой локальный index.hmtl (с помощью nginx).

Установить:

sudo apt-get install nginx

Сделать каталоги для моих статических файлов

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

в /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;
        } 
        }
    }   

Затем я использую

    sudo nginx -s reload
    sudo service nginx restart

Но в браузере localhost я вижу: If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

Мне нужно увидеть мой файл index.html (его в /opt/nginx/files). Как это исправить? Спасибо!

2
задан 31 October 2013 в 20:31

1 ответ

Я думаю, sudo chown -R www-data:www-data /opt/nginx/

И я не вижу ни одного вашего index.html в списке

0
ответ дан 31 October 2013 в 20:31

Другие вопросы по тегам:

Похожие вопросы: