R
R
RaDir2021-05-26 07:22:17
Nginx
RaDir, 2021-05-26 07:22:17

Server_name does not work in nginx config. How to fix?

Hello!
I use docker for local development in the nginx + php-fpm + apache bundle. I decided to give up Apache, created such a simple nginx config:

server {
    listen 80 default_server;
    deny all;
}

server {
    listen 80;
    server_name test-73.dev;
    root /var/www/html/test-73.dev;

    location / {
        index   index.php index.html index.htm;
    }

    location ~* \.php$ {
        fastcgi_index   index.php;
        fastcgi_pass    php:9000;
        include         fastcgi_params;
        fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
        fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
    }
}

127.0.0.1 - works out with a bang. But the second block with server_name doesn't match - ERR_CONNECTION_CLOSED. Domain added to hosts (win 10) - "127.0.0.1 test-73.dev".
What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lynn "Coffee Man", 2021-05-26
@RaDir

Don't use the .dev domain. Forced https is hardcoded for it in all browsers.
Well, or configure the server to work on https

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question