无法进入laravel项目中的公共文件夹

piwo6bdm  于 2023-05-08  发布在  其他
关注(0)|答案(1)|浏览(148)

我有一个laravel/php项目,我想通过apache2在ubuntu上部署它。首先,我尝试部署默认的示例laravel项目,它工作了。但是,当我想使用我自己的项目时,我不能进入www.example.com. enter image description here exampledomain.com/public. enter image description here
当我点击公共时,它给出HTTP500错误。
我该怎么解决这个问题?
所有项目文件都在/var/www/html文件夹中。

    • 我的. conf文件**
<VirtualHost *:80>
    ServerAdmin admin@rwg.com
    ServerName reallywildgirls.uk
    DocumentRoot /var/www/html/public

    <Directory /var/www/html>
    Options Indexes MultiViews
    AllowOverride None
    Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
    • 我的. htaccess文件**
GNU nano 2.9.3                         .htaccess                                   

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

ownership of directories

    • apache2 error. log**

[Sun[php:error][pid 8141][client 94.54.24.30:47680] PHP Fatal error:未捕获的错误异常:会话信息:SESSION_ID = bbb55553521b468fa049875c893ad8898.php无法打开流:/var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem. php:187\n堆栈跟踪:\n#0 [内部函数]:/var/w ww/html/rwg/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem. php(187):文件_put_contents()\n#2/var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler. php(169):/var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine. php(55):Copyright © 2018 - 2019 www.cnjs.com. All Rights Reserved.粤ICP备15048888号-1 Inflamate\View\Engines\CompilerEngine-> get()\n#5/var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/View/View. php(139):2019 - 06 - 22 01:01:00:00:00:00:00:00:00:00:00:00:00 Copyright © 2018 - 2019 www.laravel.com. All Rights Reserved.粤ICP备16048888号-1/var/www/html/rwg/vendor/laravel/framework/s rc/Illuminate/Http/Response. php(69):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/var/www/html/rwg/vendor/laravel/framewo rk/src/Illuminate/Routing/ResponseFactory. php(55):\r\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n Copyright © 2018 - 2019 www.largevel.com. All Rights Reserved.粤ICP备15048888号-1/var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler. php(490):/var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler. php(356):/var/www/html/rwg/app/Exceptions/Handler. php(53):Copyright © 2018 - 2019 www.largevel.com. All Rights Reserved.粤ICP备16048888号-1/var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions. php(173):Copyright © 2018 - 2019 www.jsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsjsj Illuminate\Foundation\Bootstrap\HandleExceptions-> handleException()\n#19 [内部函数]:Copyright © 2018 www.laravel.com.cn All Rights Reserved.粤ICP备15048888号-1 http://www.reallywildgirls.uk/rwg/
在我更改权限后
[Sun[php:error][pid 8141][client 94.54.24.30:48827] PHP Fatal error:/vary/www/html/vendor/symfony/polyfill-mbstring/Mbstring.php LINE:636,referer:http://www.example.com www.reallywildgirls.uk/rwg/
在取消注解mbstring之后

Sun May 07 11:31:57.828324 2023] [php:error] [pid 13170] [client 94.54.24.30:46690] PHP Fatal error: Uncaught Devfactory\Minify\Exceptions\FileNotExistException: File '/var/www/html/rwg/public/libs/cookieconsent/build/cookieconsent.min.css' does not exist in /var/www/html/rwg/vendor/devfactory/minify/src/Providers/BaseProvider.php:124\nStack trace:\n#0 /var/www/html/rwg/vendor/devfactory/minify/src/Providers/BaseProvider.php(114): Devfactory\Minify\Providers\BaseProvider->add()\n#1 /var/www/html/rwg/vendor/devfactory/minify/src/Minify.php(162): Devfactory\Minify\Providers\BaseProvider->add()\n#2 /var/www/html/rwg/vendor/devfactory/minify/src/Minify.php(91): Devfactory\Minify\Minify->process()\n#3 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Devfactory\Minify\Minify->stylesheet()\n#4 /var/www/html/rwg/storage/framework/views/ba74c2e49345ff43d748c103951d629637d2894d.php(79): Illuminate\Support\Facades\Facade::__callStatic()\n#5 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(107): require('...')\n#6 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(108): Illuminate\Filesystem\Filesystem::Illuminate\Filesystem{closure}()\n#7 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(58): Illuminate\Filesystem\Filesystem->getRequire()\n#8 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(61): Illuminate\View\Engines\PhpEngine->evaluatePath()\n#9 /var/www/html/rwg/vendor/facade/ignition/src/Views/Engines/CompilerEngine.php(37): Illuminate\View\Engines\CompilerEngine->get()\n#10 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/View.php(139): Facade\Ignition\Views\Engines\CompilerEngine->get()\n#11 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/View.php(122): Illuminate\View\View->getContents()\n#12 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/View.php(91): Illuminate\View\View->renderContents()\n#13 /var/www/html/rwg/storage/framework/views/336ebb0e53fe02354117e4938e41648b986c5fa3.php(4): Illuminate\View\View->render()\n#14 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(107): require('...')\n#15 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(108): Illuminate\Filesystem\Filesystem::Illuminate\Filesystem{closure}()\n#16 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(58): Illuminate\Filesystem\Filesystem->getRequire()\n#17 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(61): Illuminate\View\Engines\PhpEngine->evaluatePath()\n#18 /var/www/html/rwg/vendor/facade/ignition/src/Views/Engines/CompilerEngine.php(37): Illuminate\View\Engines\CompilerEngine->get()\n#19 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/View.php(139): Facade\Ignition\Views\Engines\CompilerEngine->get()\n#20 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/View.php(122): Illuminate\View\View->getContents()\n#21 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/View.php(91): Illuminate\View\View->renderContents()\n#22 /var/www/html/rwg/storage/framework/views/da0245820fb5553521b468fa049875c893ad8898.php(23): Illuminate\View\View->render()\n#23 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(107): require('...')\n#24 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(108): Illuminate\Filesystem\Filesystem::Illuminate\Filesystem{closure}()\n#25 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(58): Illuminate\Filesystem\Filesystem->getRequire()\n#26 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(61): Illuminate\View\Engines\PhpEngine->evaluatePath()\n#27 /var/www/html/rwg/vendor/facade/ignition/src/Views/Engines/CompilerEngine.php(37): Illuminate\View\Engines\CompilerEngine->get()\n#28 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/View.php(139): Facade\Ignition\Views\Engines\CompilerEngine->get()\n#29 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/View.php(122): Illuminate\View\View->getContents()\n#30 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/View.php(91): Illuminate\View\View->renderContents()\n#31 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Http/Response.php(69): Illuminate\View\View->render()\n#32 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Http/Response.php(35): Illuminate\Http\Response->setContent()\n#33 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php(55): Illuminate\Http\Response->__construct()\n#34 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php(85): Illuminate\Routing\ResponseFactory->make()\n#35 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(585): Illuminate\Routing\ResponseFactory->view()\n#36 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(490): Illuminate\Foundation\Exceptions\Handler->renderHttpException()\n#37 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(356): Illuminate\Foundation\Exceptions\Handler->prepareResponse()\n#38 /var/www/html/rwg/app/Exceptions/Handler.php(53): Illuminate\Foundation\Exceptions\Handler->render()\n#39 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(196): App\Exceptions\Handler->render()\n#40 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(173): Illuminate\Foundation\Bootstrap\HandleExceptions->renderHttpResponse()\n#41 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(209): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException()\n#42 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()\n#43 {main}\n\nNext Facade\Ignition\Exceptions\ViewException: File '/var/www/html/rwg/public/libs/cookieconsent/build/cookieconsent.min.css' does not exist (View: /var/www/html/rwg/resources/views/template/head.blade.php) in /var/www/html/rwg/vendor/devfactory/minify/src/Providers/BaseProvider.php:124\nStack trace:\n#0 /var/www/html/rwg/vendor/devfactory/minify/src/Providers/BaseProvider.php(114): Devfactory\Minify\Providers\BaseProvider->add()\n#1 /var/www/html/rwg/vendor/devfactory/minify/src/Minify.php(162): Devfactory\Minify\Providers\BaseProvider->add()\n#2 /var/www/html/rwg/vendor/devfactory/minify/src/Minify.php(91): Devfactory\Minify\Minify->process()\n#3 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Devfactory\Minify\Minify->stylesheet()\n#4 /var/www/html/rwg/resources/views/template/head.blade.php(79): Illuminate\Support\Facades\Facade::__callStatic()\n#5 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(107): require('...')\n#6 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(108): Illuminate\Filesystem\Filesystem::Illuminate\Filesystem{closure}()\n#7 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(58): Illuminate\Filesystem\Filesystem->getRequire()\n#8 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(61): Illuminate\View\Engines\PhpEngine->evaluatePath()\n#9 /var/www/html/rwg/vendor/facade/ignition/src/Views/Engines/CompilerEngine.php(37): Illuminate\View\Engines\CompilerEngine->get()\n#10 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/View.php(139): Facade\Ignition\Views\Engines\CompilerEngine->get()\n#11 /var/www/html/rwg/vendor/laravel/framework/src/Illuminate/View/View.php(122): Illuminate\View\View->getContents()\n#12 /var/www/html/rwg/ven

我也试过Nginx,它根本不起作用。我想在公共文件夹中启动index.php文件。但我没能成功。

bvjxkvbb

bvjxkvbb1#

我在问题中看到你发布了你的.htaccess

<VirtualHost *:80> 
 ServerAdmin admin@rwg.com 
 ServerName reallywildgirls.uk  
 DocumentRoot /var/www/html/public

<Directory /var/www/html>
 Options Indexes MultiViews
 AllowOverride None
 Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

这一行似乎有问题:AllowOverride None
请将其替换为:AllowOverride All
另外,请启用rewrite模块:
sudo a2enmod rewrite
编辑:请在您的服务器上安装mbstring扩展。
请使用此链接安装php-mbstring扩展。https://askubuntu.com/a/915696/503990
或者运行:sudo apt-get install php-mbstring

相关问题