The problem that the virtual machine domain name points to the shared folder 404

Environment:

vmware
php7
nginx
mysql
laravel

Mount directory / mnt/hgfs/WWW/test/l/public

first, test.com.conf under / usr/local/nginx/conf/vhost

server
{
    listen 80;
    -sharplisten [::]:80;
    server_name test.com test2.com;
    index index.html index.htm index.php default.html default.htm default.php;
    root  /mnt/hgfs/WWW/test/l/public;

    include rewrite/laravel.conf;
    -sharperror_page   404   /404.html;

    -sharp Deny access to PHP files in specific directory
    -sharplocation ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

    include enable-php-pathinfo.conf;

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
    }

    location ~ .*\.(js|css)?$
    {
        expires      12h;
    }

    location ~ /.well-known {
        allow all;
    }

    location ~ /\. {
        deny all;
    }

    access_log off;
}

next is the host file for windows

192.168.0.16 test.com

question: 404 appears to use the browser to access test.com at this time. Is it impossible for the domain name to point to the mount directory, or am I misconfigured? Pray for the Great God

Apr.02,2021

lack of communication between nginx and php

   location ~ \.php(.*)$  {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
            include        fastcgi_params;
        }

the Nginx server cannot communicate directly with the FastCGI server (that is, php-fpm) and does not recognize that php, needs to be enabled for ngx_http_fastcgi_module module proxy configuration to send requests to the FastCGI service.

fastcgi_pass is used to set the IP address (TCT socket) or UNIX socket of the FastCGI server. Fastcgi_param sets the parameters passed into the FastCGI server.

first check whether php-fpm is enabled under linux

ps aux | grep php-fpm

then nginx adds the following configuration.

 location ~ \.php$ {
     fastcgi_pass   127.0.0.1:9000;
     fastcgi_index  index.php;
     fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
     include        fastcgi_params;
 }
  • Laravel nginx https 404

    Laravel environment nginx is configured with Https access. Except the first page can be accessed normally, all routes are 404. After checking a lot of information, we can t find the reason. If you switch to http access, all visits are normal. Please ta...

    Jun.02,2022
Menu