关于laravel:第二篇Laravel10测试性能及ngnix配置Laravel10-Vue30前后端分离框架通用后台源码

章节目录
【第一篇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。如同变动不大,拜访仍旧很慢,晚点连贯数据库,测试一下性能

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理