[英]Nginx error 403 on laravel app - Centos 7
我在centos 7上運行的nginx服務器上遇到了這個煩人的403禁止錯誤
您可以自己檢查一下http://zargold.com
nginx.conf:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name zargold.com;
root /home/zargol/public_html/public;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
#location / {
# try_files $uri $uri/ /index.php;
#}
location ~ \.php$ {
#try_files $uri /index.php =404;
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
root /home/zargol/public_html/public;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
我已經為此工作了好幾天了,無法修復!
注意:我在這里使用了說明
更新 :
現在發生了一些非常奇怪的事情。
我在此vps ip地址上設置了兩個域,另一個域出現了另一個錯誤(502錯誤網關) http://zar7.com
您尚未定義index
指令,因此nginx
使用的是index index.html
的默認值。
如果根目錄中沒有index.html
文件, nginx
將返回403響應。
對於Laravel,您可能應該使用:
index index.php;
有關更多信息,請參見此文檔 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.