0

我知道这个问题已经被问了很多次了,不幸的是,在我的场景中,我似乎不知道问题出在哪里。

使用具有这些配置的 nginx 设置站点后'

server {
listen 80;
listen [::]:80;
server_name  xxxxxx.xxxxxxx.co.zw;
root   /var/www/xxxxxx;
index  index.php;

access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;

client_max_body_size 100M;

autoindex off;

location / {
    try_files $uri $uri/ /index.php$is_args$args;
}

location ~ \.php$ {
     include snippets/fastcgi-php.conf;
     fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     include fastcgi_params;
}
}'

公共(lavarel站点)中的.htacess文件具有这些配置'

  <IfModule mod_rewrite.c>
  <IfModule mod_negotiation.c>
       Options -MultiViews
  </IfModule>

  RewriteEngine On

  # Redirect Trailing Slashes...
  RewriteRule ^(.*)/$ /$1 [L,R=301]

  # Handle Front Controller...
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^ index.php [L]
  </IfModule>'

我得到的错误是“无法检索请求的 URL。无法连接到远程服务器”。当我尝试在 localhost 上运行它时,它仍然出现同样的错误。

我尝试运行这些命令,但没有成功

  sudo a2enmod rewrite
  sudo a2ensite xxxxxx.conf
  sudo systemctl restart nginx'

错误日志是空白的,这里是访问日志'

127.0.0.1 - - [13/Dec/2019:08:00:46 +0000] "GET / HTTP/1.1" 200              396 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0"
127.0.0.1 - - [13/Dec/2019:08:00:47 +0000] "GET /favicon.ico HTTP/1.1" 404 134 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0"
127.0.0.1 - - [13/Dec/2019:08:16:36 +0000] "GET /phpinfo.php  HTTP/1.1" 200       21 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:71.0) Gecko/20100101     Firefox/71.0"
127.0.0.1 - - [13/Dec/2019:08:17:43 +0000] "GET / HTTP/1.1" 304 0 "-"     "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0"'

请帮忙。

4

1 回答 1

0

请检查 nginx 的 access.log 和 error.log 来调试这个问题。

于 2019-12-13T12:37:09.787 回答