章节目录
【第一篇Laravel10安装】Laravel10 + Vue3.0前后端分离框架通用后台源码

vscode 打开 laravel10-vue3-admin

routes/web.php

新增如下代码

Route::get('/hello', function () {
    echo "hello";
});

运行效果,36s

分析性能,简单hello都要36s。连接数据库,加上代码逻辑。估计要100s+呢。由于之前采用的是,php artisan serve,这边换ngnix环境尝试一下,看一下访问速度是否有变化

配置ngnix
打开file:///usr/local/etc/nginx/servers/laravel10-vue3.notestore.cn文件没有则新建哦

内容如下:

server {

    listen 80;
    server_name laravel10-vue3.notestore.cn;
    index index.html index.php;
    root /Users/beichen/Documents/laravel10-vue3-admin/backend/public;
    
 
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
        fastcgi_pass     127.0.0.1:9000;
        fastcgi_index    index.php;
        include          fastcgi_params;
        fastcgi_param    SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    }  

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

}

重启ngnix服务
brew services restart nginx

进入
/etc

hosts文件,新增如下
127.0.0.1 laravel10-vue3.notestore.cn

效果如下,38s。好像变化不大,访问依旧很慢,晚点连接数据库,测试一下性能

点我购买,【小编推荐】Laravel10 + Vue3.0前后端分离框架通用后台源码(正版源码,自动发货)


ThinkPHP
4 声望3 粉丝

引用和评论

0 条评论