E
E
Evgeny Kramor2019-03-11 14:31:41
Nginx
Evgeny Kramor, 2019-03-11 14:31:41

Why is it impossible to access the site on the specified server_name?

config:

server {
         listen 80;
         listen [::]:80 ipv6only=on;
 
         # Log files for Debugging
         access_log /var/log/nginx/laravel-access.log;
         error_log /var/log/nginx/laravel-error.log;
 
         # Webroot Directory for Laravel project
         root /var/www/laravel/public;
         index index.php index.html index.htm;
 
         # Your Domain Name
         server_name laravel.hakase-labs.co;
 
         location / {
                 try_files $uri $uri/ /index.php?$query_string;
         }
 
         # PHP-FPM Configuration Nginx
         location ~ \.php$ {
                 try_files $uri =404;
                 fastcgi_split_path_info ^(.+\.php)(/.+)$;
                 fastcgi_pass unix:/run/php/php7.2-fpm.sock;
                 fastcgi_index index.php;
                 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                 include fastcgi_params;
         }
 }

When going to laravel.hakase-labs.co, the server was not found, but if you go to localhost/ ( 127.0.0.1/), then the project loads successfully. What could be the problem? Maybe it is necessary to register something in hosts?
Working on Ubuntu 18.04

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question