我用FOSUserBundle创建了Symfony 3项目,我使用命令安装了该项目:
$ composer require friendsofsymfony/user-bundle "~2.0@dev"
这是我的security.yml:
# To get started with security, check out the documentation:
# http://symfony.com/doc/current/security.html
security:
encoders:
FOS\UserBundle\Model\UserInterface: bcrypt
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
# http://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
providers:
fos_userbundle:
id: fos_user.user_provider.username_email
# in_memory:
# memory: ~
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
# dev:
# pattern: ^/(_(profiler|wdt)|css|images|js)/
# security: false
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
# if you are using Symfony < 2.8, use the following config instead:
# csrf_provider: form.csrf_provider
logout: true
anonymous: true
#anonymous: ~
# activate different ways to authenticate
# http_basic: ~
# http://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
# form_login: ~
# http://symfony.com/doc/current/cookbook/security/form_login_setup.html
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/group/(\d)+/((delete)|(edit)), role: ROLE_USER }
- { path: ^/group/(my)|(new), role: ROLE_USER }
问题是:在开发环境中的localhost上工作正常但是当我在共享主机上移动它时,它只是赢得不显示登录或注册页面,当我尝试访问/登录页面时,它只是重新定向(301)我在主页面上。 ubuntu或symfony日志中没有任何内容。
我很沮丧,拜托,有人知道怎么处理这个吗?