«

本地Laravel项目配置nginx虚拟主机

chunkuan 发布于 阅读:142 命令行


配置nginx虚拟主机(Laravel):

server {
    listen       80;
    server_name  hello.test;

    index index.php index.html;

    root /Users/chunkuan/data/wwwroot/hello.test/public;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass   unix:/Users/chunkuan/data/conf/socket/php-fpm7.4.socket;

        fastcgi_param           PATH_INFO       $fastcgi_path_info;
        fastcgi_param           SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param           SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include                 fastcgi_params;

        #fastcgi_param PHP_ADMIN_VALUE open_basedir=/Users/chunkuan/data/wwwroot/hello.test/:/tmp/;
    }

    #error_log /Users/chunkuan/data/log/nginx/hello.test.error.log;

    #access_log  /Users/chunkuan/data/log/nginx/hello.test.access.log;
}

socket 虚拟主机 nginx 伪静态