我已经创build并启用了以下configuration:
server { listen 80; listen [::]:80; root /home/ubuntu/www/storage; index index.html index.htm index.nginx-debian.html; server_name cdn.example.com; location / { autoindex on; autoindex_exact_size off; autoindex_format html; autoindex_localtime on; try_files $uri /index.php$is_args$args; } rewrite ^themes/.*/(layouts|pages|partials)/.*.htm /index.php break; rewrite ^bootstrap/.* /index.php break; rewrite ^config/.* /index.php break; rewrite ^vendor/.* /index.php break; location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.1-fpm.sock; } location ~ /\.ht { deny all; } client_max_body_size 40M; }
我试图列出storage
文件夹中的文件和目录,但是当我浏览链接: http : //cdn.example.com它会产生404错误:
404找不到文件
我尝试了许多解决scheme后发现它。
解决scheme是删除try_files $uri /index.php$is_args$args;
行并重新启动nginx
服务器。 然后path显示文件和目录。