I
I
inFureal2022-03-17 13:59:24
Nginx
inFureal, 2022-03-17 13:59:24

Windows hosts file for external IP address?

Good afternoon. Rented a server from DigitalOcean. There is no need to buy a domain.
Installed Nginx, PHP8.1-FPM. I wanted to check how the server works and whether everything is configured correctly. To do this, I created a simple stub.

Nginx settings:

server {
        listen 80;
        listen [::]:80;
        root /var/www/sample.test;
        index index.php index.html;
        server_name sample.test;

        charset utf-8;

        location / {
                try_files $uri $uri/ /index.php?$query_string;
        }

        location ~ \.php$ {
                fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
                fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
                include fastcgi_params;
        }

        location ~ /\.(?!well-known).* {
                deny all;
        }
}


I registered in my Windows hosts file:
<тут-ip-ардес> sample.test

And then the problems began. There is direct IP access. Everything works and shows the stub as it should. But when I try to get through the domain, the browser gives an error ERR_CONNECTION_REFUSED.

Also, if you register a file on the hosts server itself and make a request curl sample.test, then everything works out as it should.

--- UPD
Added another IP address to check 104.22.1.126 laravel.test- produces a DNS resolution error. Those. the local computer through the laravel.test domain still reached the host

--- UPD 2 [Wrong]
Assumption. DigitalOcean itself blocks access through a domain if it does not find DNS records for that domain. Then a side question. How to allow access on a non-existent domain to a droplet?

---UPD 3
https://www.digitalocean.com/community/questions/w...
Created a ticket on DigitalOcean itself. We wait.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
inFureal, 2022-03-17
@inFureal

.test domain. Not intended to be set as a top-level domain in DNS

Based on a wiki article .
If you substitute any other domain, everything works as it should. Even existing

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question