gpt4 book ai didi

laravel - 主页加载,其他页面没有

转载 作者:行者123 更新时间:2023-12-04 19:01:55 25 4
gpt4 key购买 nike

我的 nginx ubuntu 网络服务器上有我的 laravel 项目。

我可以看到主页,但所有其他页面都失败了。

有谁知道为什么会这样?

我怀疑这与站点可用文件中的这一行有关:

try_files $uri $uri/ =404;

任何人都可以发布他们自己的网站可用文件吗?

最佳答案

尝试以下

location / {
try_files $uri $uri/ /index.php?$is_args$args;
}

完整配置:
server {
listen 80 default_server;
listen [::]:80 default_server;

root /path/to/your/laravel/public;
index index.html index.htm index.php;

server_name your_domain.com;
charset utf-8;

gzip on;
gzip_vary on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied off;
gzip_types text/plain text/css text/xml application/javascript application/json application/xml application/xml+rss;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$is_args$args;
}

location = /favicon.ico { access_log off; log_not_found off; }

location = /robots.txt { access_log off; log_not_found off; }

access_log off;
error_log /var/log/nginx/your_error.log error;

sendfile off;

client_max_body_size 100m;

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}

location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|svg|woff|woff2|ttf)$ { expires 1M;
access_log off;
add_header Cache-Control "public";
}

location ~* \.(?:css|js)$ {
expires 7d;
access_log off;
add_header Cache-Control "public";
}

location ~ /\.ht {
deny all;
}

}

关于laravel - 主页加载,其他页面没有,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40279028/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com