Я развертываю приложение Symfony 4, которое будет доступно через прокси: https://proxydomain.com/application
Приложение работает, если к нему обращаются по URL без косой черты: https://proxydomain.com/application
но когда в конце добавляю shlash (https://proxydomain.com/application/
) nginx возвращает 404.
Вот фрагмент журнала этих двух примеров:
172.20.83.254 - - [11/Jun/2019:16:10:06 +0200] "GET / HTTP/1.1" 200 316 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/74.0.3729.169 Chrome/74.0.3729.169 Safari/537.36"
172.20.83.254 - - [11/Jun/2019:16:10:03 +0200] "GET // HTTP/1.1" 404 522 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/74.0.3729.169 Chrome/74.0.3729.169 Safari/537.36"
И вот мой файл конфигурации nginx:
server {
server_name _;
root /var/www/application/public;
location / {
# try to serve file directly, fallback to app.php
try_files $uri /index.php$is_args$args;
}
# PROD
location ~ ^/index\.php(/|$) {
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
# When you are using symlinks to link the document root to the
# current version of your application, you should pass the real
# application path instead of the path to the symlink to PHP
# FPM.
# Otherwise, PHP's OPcache may not properly detect changes to
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
# for more information).
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
# Prevents URIs that include the front controller. This will 404:
# http://domain.tld/app.php/some-path
# Remove the internal directive to allow URIs like this
internal;
}
# return 404 for all other php files not matching the front controller
# this prevents access to other php files you don't want to be accessible.
location ~ \.php$ {
return 404;
}
error_log /var/log/nginx/application_error.log;
access_log /var/log/nginx/application_access.log;
}
Вы знаете, что я могу сделать, чтобы это работало?