我在 Linux 中使用托管,并在 Apache2 服务器中的网站中配置了子域。我正在使用 laravel 但默认情况下我没有使用 apache2 服务。我正在使用 laravel artisan 命令。
php artisan 服务 --host 0.0.0.0
它将侦听端口 8000。因此,为了访问我的网站,我使用http://我的IP地址:8000来访问它。
我尝试“chmod 755或777公共文件夹”但仍然不起作用。我的 .htaccess 在 laravel/public 文件夹中
.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
当我使用端口 8000 访问我的网站时,以下是我的错误:
PHP Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
PHP Fatal error: Unknown: Failed opening required 'server.php' (include_path='.:/usr/share/php:/usr/share/php/PEAR') in Unknown on line 0
我知道这是一个老问题,但我遇到了同样的问题,我通过添加一个解决方案找到了解决方案server.php
文件到根目录项目的内容如下:
<?php
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri))
{
return false;
}
require_once __DIR__.'/public/index.php';
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)