簡體   English   中英

Symfony app 403禁止錯誤:您無權訪問此服務器上的/

[英]Symfony app 403 Forbidden error: You don't have permission to access / on this server

我正在嘗試在CentOS7 linode服務器上運行symfony應用程序,但我收到一個錯誤:

Cannot serve directory <path to project>: No matching DirectoryIndex (index.html, index.php) 

我有這個配置的子域的vhost設置:

<VirtualHost *:80>
     ServerAdmin pak11273@gmail.com
     ServerName mister
     ServerAlias project.mystuff.com
     DocumentRoot /var/www/html/project
     ErrorLog /var/www/html/project/logs/error.log
     CustomLog /var/www/html/project/logs/access.log combined
     <Directory "/var/www/html/project" >
         #Options FollowSymLinks
         Options -Indexes
         AllowOverride All
         Require all granted
     </Directory>
</VirtualHost>

我目前的設置是:
1)我的網絡服務器用戶和組是apache
2)我對/ var / www / html / project的權限是755 with apache:apache

我在互聯網上嘗試了以下建議無濟於事:

1)更改選項 - 指數選項+索引
2)添加了DirectoryIndex index.html
3)如果我更改/ var的root權限,我會收到服務器錯誤

我正在使用CentOS 6和Apache。 試試這個改變:

<VirtualHost *:80>
     ServerAdmin pak11273@gmail.com
     ServerName mister
     ServerAlias project.mystuff.com
     DocumentRoot /var/www/html/project/web
     ErrorLog /var/www/html/project/var/logs/error.log
     CustomLog /var/www/html/project/var/logs/access.log combined
     <Directory "/var/www/html/project/web" >
         Options Indexes FollowSymLinks MultiViews
         AllowOverride All
         Require all granted
     </Directory>
</VirtualHost>

還要驗證您是否可以使用wgetcurl在localhost上獲取Symfony index.html頁面。 CentOS可能啟用了SELinux甚至iptables。

使用sestatus查看是否設置為強制執行 - 如果是這樣,您需要允許Web或臨時禁用SELinux。

xabbuh是對的。 “web”目錄是您需要用作Web根目錄的文件夾。 如果更新了我的帖子以反映所需的更改。

暫無
暫無

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

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