nginx:如何从根目录的子文件夹提供文件?
我的本地dev env在nginx上按原样配置nginx:如何从根目录的子文件夹提供文件?,nginx,laravel-5,Nginx,Laravel 5,我的本地dev env在nginx上按原样配置 server { listen 80; server_name project.local; root /var/www/project.local/public; charset utf-8; index index.php index.html index.htm; location / { try_files $uri $uri
server {
listen 80;
server_name project.local;
root /var/www/project.local/public;
charset utf-8;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
# Questi due parametri sono fondamentali
# per le app Laravel
# => https://serverfault.com/a/927619/178670
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
问题只与根目录中的文件夹/字体有关,位于/var/www/project.local/fonts
注意:这不是我的代码,我继承了它…:(
注2:这是一个古老的laravel 5.4项目
实际上,当网站查找字体/some.file时,我得到了一个404,但文件已经在这里了
我应该在nginx conf中更改什么以允许从/var/www/project.local/fonts提供/font/some.file
为什么实际不起作用?修复了添加问题
location /fonts {
root /var/www/prod.revisions;
}