提问人:Ramisha Mukhtar 提问时间:10/17/2023 最后编辑:Ramisha Mukhtar 更新时间:10/17/2023 访问量:26
PHP Laravel 项目给出 403 禁止
PHP Laravel project gives 403 forbidden
问:
我在目录中有一个项目,项目结构就像它本身一样,在其中创建了多个 laravel 项目,如下所示:xyz
var/www/html/xyz
xyz
var/www/html/xyz/public_site
var/www/html/xyz/admin
var/www/html/xyz/frontend
var/www/html/xyz/api
.
.
.
所有这些都被组合在一起,它作为一个项目运行,其中一些只有前端有 Vue.js,有些项目作为后端或 API。现在,首先我不知道如何运行这种类型的项目,因为一些内部项目只有 vue 组件。到目前为止,我尝试过的是在 ubuntu 的 apache2 上创建一个虚拟主机,当我运行它时它工作正常,但是当我访问项目时,apache 在此 URL 上禁止 403。xyz
xyz.local
admin
xyz.local/admin
Virtualhost 的创建方式如下:
<VirtualHost *:80>
ServerAdmin webmaster@xyz
ServerName xyz.local
DocumentRoot /var/www/html/xyz.com/public_html/
<Directory /var/www/html/xyz.com/public_html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
项目文件夹中有 .htaccess 文件public_html如下所示:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
#Rewrite requests to the S3 bucket
#Redirect Trailing Slashes...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
#Handle Front Controller...
#RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/api [NC]
RewriteCond %{REQUEST_URI} !^/admin [NC]
RewriteCond %{REQUEST_URI} !^/opelia [NC]
RewriteCond %{REQUEST_URI} !^/check-in [NC]
RewriteCond %{REQUEST_URI} !^/callsearch [NC]
RewriteCond %{REQUEST_URI} !^/security-app [NC]
RewriteCond %{REQUEST_URI} !^/delivery-app [NC]
RewriteCond %{REQUEST_URI} !^/social [NC]
RewriteCond %{REQUEST_URI} !^/uploads [NC]
RewriteRule ^ index.php [L]
#Handle Admin Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/opelia [NC]
RewriteCond %{REQUEST_URI} !^/check-in [NC]
RewriteCond %{REQUEST_URI} !^/callsearch [NC]
RewriteCond %{REQUEST_URI} !^/security-app [NC]
RewriteCond %{REQUEST_URI} ^/admin [NC]
RewriteCond %{REQUEST_URI} !^/delivery-app [NC]
RewriteCond %{REQUEST_URI} !^/social [NC]
RewriteCond %{REQUEST_URI} !^/uploads [NC]
RewriteRule ^ admin.php [L]
#Handle API Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/admin [NC]
RewriteCond %{REQUEST_URI} !^/opelia [NC]
RewriteCond %{REQUEST_URI} !^/api/v2 [NC]
RewriteCond %{REQUEST_URI} !^/check-in [NC]
RewriteCond %{REQUEST_URI} !^/callsearch [NC]
RewriteCond %{REQUEST_URI} !^/security-app [NC]
RewriteCond %{REQUEST_URI} !^/delivery-app [NC]
RewriteCond %{REQUEST_URI} ^/api [NC]
RewriteCond %{REQUEST_URI} !^/social [NC]
RewriteCond %{REQUEST_URI} !^/uploads [NC]
RewriteRule ^ api.php [L]
#Handle adminRestaurant Controller...
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/admin [NC]
RewriteCond %{REQUEST_URI} !^/api [NC]
RewriteCond %{REQUEST_URI} !^/check-in [NC]
RewriteCond %{REQUEST_URI} !^/callsearch [NC]
RewriteCond %{REQUEST_URI} !^/security-app [NC]
RewriteCond %{REQUEST_URI} !^/delivery-app [NC]
RewriteCond %{REQUEST_URI} !^/social [NC]
RewriteCond %{REQUEST_URI} !^/uploads [NC]
RewriteRule ^ adminRest.php [L]
#Handle APIV2 Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/admin [NC]
RewriteCond %{REQUEST_URI} !^/opelia [NC]
RewriteCond %{REQUEST_URI} !^/check-in [NC]
RewriteCond %{REQUEST_URI} !^/callsearch [NC]
RewriteCond %{REQUEST_URI} !^/security-app [NC]
RewriteCond %{REQUEST_URI} !^/delivery-app [NC]
RewriteCond %{REQUEST_URI} ^/api/v2 [NC]
RewriteCond %{REQUEST_URI} !^/social [NC]
RewriteCond %{REQUEST_URI} !^/uploads [NC]
RewriteRule ^((?s).*)$ apiV2.php?_url=/$1 [QSA,L]
#Handle Checkin App Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/admin [NC]
RewriteCond %{REQUEST_URI} !^/opelia [NC]
RewriteCond %{REQUEST_URI} !^/api/v2 [NC]
RewriteCond %{REQUEST_URI} !^/api [NC]
RewriteCond %{REQUEST_URI} !^/callsearch [NC]
RewriteCond %{REQUEST_URI} !^/security-app [NC]
RewriteCond %{REQUEST_URI} !^/delivery-app [NC]
RewriteCond %{REQUEST_URI} ^/check-in [NC]
RewriteCond %{REQUEST_URI} !^/social [NC]
RewriteCond %{REQUEST_URI} !^/uploads [NC]
RewriteRule ^ check-in.php [L]
#Handle Callsearch App Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/admin [NC]
RewriteCond %{REQUEST_URI} !^/opelia [NC]
RewriteCond %{REQUEST_URI} !^/api/v2 [NC]
RewriteCond %{REQUEST_URI} !^/api [NC]
RewriteCond %{REQUEST_URI} !^/check-in [NC]
RewriteCond %{REQUEST_URI} !^/security-app [NC]
RewriteCond %{REQUEST_URI} !^/delivery-app [NC]
RewriteCond %{REQUEST_URI} !^/social [NC]
RewriteCond %{REQUEST_URI} !^/uploads [NC]
RewriteRule ^ callsearch.php [L]
#Handle Callsearch App Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/admin [NC]
RewriteCond %{REQUEST_URI} !^/opelia [NC]
RewriteCond %{REQUEST_URI} !^/api/v2 [NC]
RewriteCond %{REQUEST_URI} !^/api [NC]
RewriteCond %{REQUEST_URI} !^/check-in [NC]
RewriteCond %{REQUEST_URI} !^/callsearch [NC]
RewriteCond %{REQUEST_URI} !^/delivery-app [NC]
RewriteCond %{REQUEST_URI} !^/social [NC]
RewriteCond %{REQUEST_URI} !^/uploads [NC]
RewriteRule ^ security-app.php [L]
#Handle Delivery App Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/admin [NC]
RewriteCond %{REQUEST_URI} !^/opelia [NC]
RewriteCond %{REQUEST_URI} !^/api/v2 [NC]
RewriteCond %{REQUEST_URI} !^/api [NC]
RewriteCond %{REQUEST_URI} !^/check-in [NC]
RewriteCond %{REQUEST_URI} !^/callsearch [NC]
RewriteCond %{REQUEST_URI} !^/security-app [NC]
RewriteCond %{REQUEST_URI} !^/social [NC]
RewriteCond %{REQUEST_URI} !^/uploads [NC]
RewriteRule ^ delivery-app.php [L]
#Handle Social App Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/admin [NC]
RewriteCond %{REQUEST_URI} !^/opelia [NC]
RewriteCond %{REQUEST_URI} !^/api/v2 [NC]
RewriteCond %{REQUEST_URI} !^/api [NC]
RewriteCond %{REQUEST_URI} !^/check-in [NC]
RewriteCond %{REQUEST_URI} !^/callsearch [NC]
RewriteCond %{REQUEST_URI} !^/security-app [NC]
RewriteCond %{REQUEST_URI} !^/delivery-app [NC]
RewriteCond %{REQUEST_URI} !^/uploads [NC]
RewriteRule ^ social.php [L]
RewriteRule ^uploads/(.*)$ https://xyz-files-new.s3.amazonaws.com/uploads/$1[R=301,L]
#Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
#php -- BEGIN cPanel-generated handler, do not edit
#Set the “ea-php56” package as the default “PHP” programming language.
<IfModule mime_module>
#AddType application/x-httpd-ea-php56 .php .php5 .phtml
#AddType application/x-httpd-ea-php70 .php .php5 .phtml
</IfModule>
#php -- END cPanel-generated handler, do not edit
Apache 具有以下功能:error.log
Permission denied: [client 127.0.0.1:54374] AH00035: access to /admin denied (filesystem path '/var/www/html/xyz.com/public_html') because search permissions are missing on a component of the path
答: 暂无答案
评论