Серверные блоки Nginx на CentOS 7 - PullRequest
       12

Серверные блоки Nginx на CentOS 7

0 голосов
/ 30 сентября 2019

Я хотел бы запустить laravel на nginx и установить блок сервера. У меня есть домен, и он правильно связан с IP-адресом облачного сервера. Если я набираю в браузере мой ip-адрес, все работает нормально, но если я набираю домен, получаю ERR_NAME_NOT_RESOLVED.

, вот мой файл конфигурации nginx

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
  include /usr/share/nginx/modules/*.conf;



 events {
    worker_connections 1024;
  }

  http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
access_log  /var/log/nginx/access.log  main;

sendfile            on;
tcp_nopush          on;
tcp_nodelay         on;
keepalive_timeout   65;
types_hash_max_size 2048;

include             /etc/nginx/mime.types;
default_type        application/octet-stream;

# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;

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 mydomain.it;

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


}

, пока я в моем conf.dУ меня есть Laravel.conf

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 mydomain.it;

        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-fpm/php-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}

Есть ли у вас какие-либо идеи, что ошибка в файле конфигурации?

Обновление: в моем журнале ошибок Laravel У меня есть это:

2019/09/30 11:33:28 [crit] 27864#0: *1 connect() to unix:/run/php/php7.2-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 93.xxx.xxx.xxx, server: mydomain.it, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host: "80.xxx.xxx.xxx", referrer: "http://80.xxx.xxx.xxx/dashboard/IBPM020007/istituto"
...