我刚刚将我的应用程序部署到AMI ec2服务器并按照一些教程进行了解释,修改了config / app.php,如:
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://52.67.251.19/'),
...并按如下方式更改httpd.conf:
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/html/nnid/public/"
#
# Relax access to content within /var/www.
#
<Directory "/var/www/nnid/public/">
AllowOverride None
# Allow open access:
Require all granted
</Directory>
但是除了着陆页之外,所有页面都没有找到。任何提示?
答案 0 :(得分:0)
确保您的服务器上已打开mod_rewrite。
此外,Laravel 5.6还在公共文件夹中附带此.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]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
确保它与您当前的匹配。
答案 1 :(得分:0)
解决了! 问题出在httpd.conf模式ReWrite。改为全部,轻而易举地工作!