繁体   English   中英

配置服务器以在'/'Laravel项目上打开public / index.php

[英]Configure server to open public/index.php on '/' Laravel Project

我目前正在首次部署laravel项目。 我已经成功在服务器上安装了laravel项目,但是不幸的是,当转到网站时,没有显示laravel页面。 我的.htaccess文件在根目录中:

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

    RewriteEngine On

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

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(www.)?mydomain.nl$
    RewriteRule ^(/)?$ public [L]
</IfModule>

有人可以帮我解决这个问题吗?

我们不知道这是什么类型的服务器以及您在哪里购买的(AWS,Digital Ocean)。

通常,您必须移至服务器中的以下目录:

/etc/apache2/sites-enabled/laravel.conf

现在,您可以使用vi或nano触摸来打开该文件:

sudo nano laravel.conf

该文件应与此内容类似:

<VirtualHost *:80>.
    ServerName app.com // your server name
    ServerAdmin webmaster@localhost
    # Your Custom folder 
    DocumentRoot /dir/dir/dir/app/public/ // here you need to add your location
    <Directory /dir/dir/dir/app/public/>  // here you need to add your location
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log
</VirtualHost>

现在,您需要像在示例配置文件中一样,将位置更改为您的应用/公共位置。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM