laravel localhost项目想要在斜杠文件夹(例如“ domain_name.com/folder_name”)上实时启动,但出现配置错误

时间:2019-06-17 06:08:15

标签: php laravel

laravel项目在localhost上正常工作。.

现在我已将其上载到活动的斜杠文件夹中,例如“ domain_name.com/folder_name”

我已经按原样上传了localhost项目文件夹(只是.env参数更改了。)

文件夹结构:

Project Folder -
   app -
   bootstrap -
   ....
   ....
   public -
     ....
     ....
     .htaccess
     index.php
   ....
   vendor
   ....
   .env
   server.php
   ....

我尝试了两种方法:

First Try-
1) server.php of root folder renamed to index.php
2) .htaccess moved from public folder to root folder
First Try resulting to "misconfiguration error"

Second Try-
1) .htaccess & index.php moved from public folder to root folder
2) In index.php..
     a) require __DIR__.'/../lara/vendor/autoload.php';
        changed to
        require __DIR__.'/vendor/autoload.php';
     b) $app = require_once __DIR__.'/../lara/bootstrap/app.php';
        changed to
        $app = require_once __DIR__.'/bootstrap/app.php';
         Second Try resulting to "don't have permission to access /lara/ on this server"

在两次试用中,我都获得了所需文件的完全许可,尽管未获得预期的结果

请给我建议正确的配置。

预先感谢

1 个答案:

答案 0 :(得分:0)

尝试设置虚拟主机,并将其指向应用程序的公用文件夹。 例如:

DocumentRoot /var/www/html/your-folder/public
    <Directory "/var/www/html/your-folder/public">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

允许覆盖所有权限