duanba5777 2017-04-20 08:52
浏览 544
已采纳

Laravel加载视图需要很长时间

I have a LEMP stack setup using vagrant and virtual box on a windows Machine. php is version 7.0, Nginx is version 1.4.6. I've allocated a RAM of 768mb to the guest machine(Ubuntu 14.04.5 LTS)

On the guest machine, I've installed and configured composer as instructed on the Laravel documentation page. Using the Laravel installer, I installed Laravel in the www directory of my host machine laravel new commerce So the path to my laravel installation looks something like this /vagrant/www/commerce

In my Nginx config file, I configured Nginx to serve files from this location /vagrant/www/commerce/public and to redirect all request to the index page try_files $uri $uri/ /index.php?$query_string;

In the browser(chrome) when I test to see if everything is working fine, it takes about 4-5 seconds for the Laravel landing page to display in the browser. This is the same for safari and firefox. I shut down the guest machine and restarted it several times but the landing page still takes about 4-5 seconds to display.

I stumbled upon a post somewhere online where I was told to install debugbar. I installed debugbar successfully. When I tested in the browser again, It took about 16 seconds for the landing page to display. The strange thing here is that debugbar logged no messages. Frustrating.

Another solution suggested slowlog. So, first, i uninstalled debugbar and in my guest machine, i configured slowlog to track slow requests. I set a timeout of 10s. When i checked the slow.log file in /var/log I got what's in the image below slow.log I can't seem to make any sense out of this. please i need help.

Thanks in advance

  • 写回答

1条回答 默认 最新

  • dongya9904 2017-04-20 09:09
    关注

    I had a similar issue, and enabling NFS for folder sharing fixed it. Add NFS to ~/Homestead/Homestead.yaml

    folders:
    - map: ~/www/commerce
      to: /vagrant/www/commerce
      type: "nfs"
    

    And then provision your server.

    vagrant halt
    vagrant up --provision
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?