簡體   English   中英

在子文件夾中安裝了Laravel,但首頁顯示的索引

[英]Installed Laravel in subfolder but home page shows Index of

我知道有很多類似的帖子,但是經過3個小時的研究,我仍然找不到解決方案。 希望有人能幫忙。

使用的技術:

  • Apache / 2.4.7(Ubuntu)
  • Laravel 5.4
  • PHP 7.0

/etc/apache2/site-enabled/000-default.conf

<VirtualHost *:80>
        ServerAdmin stanley@example.com
        Servername example.com
        DocumentRoot /var/www/html/example.com
        <Directory />
                Options +FollowSymLinks
                #AllowOverride None
                Require all granted
        </Directory>
        <Directory /var/www/html/example.com/>
                Options +Indexes +FollowSymLinks +MultiViews
                AllowOverride All
                Require all granted
        </Directory>

        <Directory "/var/www/html/example.com/parcgilley/public">
                Options Includes Indexes FollowSymLinks
                DirectoryIndex index.php
                Order allow,deny
                Allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI +MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    .......

因此,文檔根目錄位於/var/www/html/example.com,而我的laravel網站位於/var/www/html/example.com/parcgilley。 我嘗試配置000-default.conf以將我的站點指向/var/www/html/example.com/parcgilley/public,但是當我轉到example.com/parcgilley時,它顯示“ / parcgilley的索引”。 當我導航至http://www.example.com/parcgilley/public/時 ,Chrome瀏覽器顯示“此頁面無法使用”。

這是我的public / .htaccess文件:

Options +FollowSymLinks
RewriteEngine On

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

這不是原始內容。 我按照Laravel的指示進行操作 ,因此我用上述代碼替換了原點。

另外,我已經為/ parcgilley項目根文件夾和存儲文件夾設置了權限,但是沒有用。

我不知道是否需要創建.htaccess文件來指向/ public文件夾。 但是我對apache配置了解不多。

任何見識將不勝感激。

編輯:

我還使用SSH和Git將網站從本地計算機推送到服務器,裸倉庫位於/var/repo/site.git。 我不知道這是否與問題有關。

您是否嘗試通過.htaccess禁用目錄列表?

Options -Indexes

這是更多信息: https : //www.thesitewizard.com/apache/prevent-directory-listing-htaccess.shtml

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM