I
I
idin2017-10-08 01:11:37
Nginx
idin, 2017-10-08 01:11:37

Learning to configure ngnix, what's wrong with my settings?

I decided to take a VPS for myself, I want ngnix to display a static index.html page when they visit the domain, but I realized that it's not so simple.
Can't configure server, here is my ngnix.conf file

user  www-data;

worker_processes  auto;
events {
    use epoll;
    worker_connections 1024;
    multi_accept on;
}
http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

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

    keepalive_timeout  30;
    keepalive_requests 100;

    client_max_body_size  1m;
    client_body_timeout 10;
    reset_timedout_connection on;
    send_timeout 2;
    sendfile on;
    tcp_nodelay on;
    tcp_nopush on;

    gzip on;
    gzip_disable "msie6";
    gzip_proxied any;
    gzip_min_length 1024;
    gzip_comp_level 4;
    gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+r$

    open_file_cache max=200000 inactive=20s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 2;
    open_file_cache_errors on;

    include /etc/nginx/sites-enabled/*;
}

then I created a folder with the etc/nginx/sites-available/sdfsadf.conf file
with the following content
server {

        listen 80;
        charset utf-8;

        root /var/www/itant;
        server_name sdfswdvfa.ru;
        access_log /var/log/nginx/it_anthill_access.log;
        error_log /var/log/nginx/it_anthill_error.log;

        location / {
                index   index.php index.html;

}
        location ~ /\.ht {
                deny  all;
        }
}

server {

  listen 80;

  server_name www.adsfsdf.ru;
  rewrite ^(.*) http://asdgfawef$1 permanent;
}

then I made a symlink to the etc/nginx/sites-enabled/@sdfsdfs.conf folder,
then I made a simple html along the path var/www/itant/index.html
and in general nothing works, and there is nothing in the logs either ((

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Mukovoz, 2017-10-08
@Izy

Your domain is not directed, even the browser says so.
From your comment it is clear that you sent all subdomains to your server, except for the main domain. To fix it, in the second A record, change www to @ and wait, it doesn't change instantly.

M
Maxim Fedorov, 2017-10-08
@Maksclub

to find out what nginx is complaining about, run the command before restarting:
it will swear at those lines in those files that it does not like
...
the folder with the error is named - you need sites-available
Then just create the sites-enabled
folder. link:
and restart nginx:
To see if the server is working or not:
Also: maybe the DNS has not been updated yet, the domain has just been registered, maybe the NS servers have been changed?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question