Это моя конфигурация:Symfony 2 Nginx configuraiton выбрасывает ошибку 500
server {
server_name domain.com;
root /var/www/domain.com/web;
location/{
# try to serve file directly, fallback to app.php
try_files $uri /app.php$is_args$args;
}
# DEV
# This rule should only be placed on your development environment
# In production, don't include this and don't deploy app_dev.php or config.php
location ~ ^/(app_dev|config)\.php(/|$) {
fastcgi_pass unix:/var/run/php5-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;
}
# PROD
location ~ ^/app\.php(/|$) {
fastcgi_pass unix:/var/run/php5-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;
}
error_log /var/log/nginx/domain.com.error.log;
access_log /var/log/nginx/domain.com.access.log;
}
Сайт работает почта, domain.com/
, но всякий раз, когда я открываю любой другой маршрут, как domain.com/test/
я получаю 500 внутренняя ошибка сервера.
Кроме того, когда я открываю среду разработчика, как domain.com/app_dev.php/test/
Я получаю сообщение об ошибке, что я не могу получить доступ к файлу app_dev.php
.
Что случилось?
Это может работать, как это официальная конфигурация Nginx из [symfony.com] (http://symfony.com/doc/current/cookbook/configuration/web_server_configuration.html#nginx), не могли бы вы предоставить дополнительную информацию о вашем приложении, например, ваш контроллер и файл 'routing.yml'? Что же касается 'app_dev.php' - доступ к этому файлу закрыт не из localhost по соображениям безопасности, вы можете сами посмотреть код и даже удалить защиту, если вам нужно. – chapay
Также вы можете просмотреть свои журналы: '/ var/log/nginx/domain.com.error.log' и'/var/www/domain.com/app/logs/prod.log' для получения дополнительной информации. – chapay
Журналы пустые - как в приложении, так и nginx. Как будто ничего не происходит, когда я вхожу в любой маршрут. – user99999