2

I am trying to deploy my Yii2 application using Deployer

My server is Ubuntu server 16.4.10 LTS, I have configured everything right, When I simply copy the project to server using filezilla everything works fine but when I deploy it with deployer I get this error in google chrome:

Redirected too many times

I've tried configuring deployer a couple of times differently but I get the same error.
p.s: I have used deployer for my other project with this configuration type and it works without any problem.

TheDevWay
  • 1,363
  • 1
  • 16
  • 45
  • have you checked your htaccess file, it may cause redirection loop. – Nitin Pund Oct 20 '16 at 08:54
  • @Nitin My htaccess rules are the ones to enable prettyUrl for yii2, I will attach the content of .htaccess but I don't think that causes the problem. – TheDevWay Oct 20 '16 at 09:33
  • @Nitin I will also attach the content of my site-available .conf file if that could help. – TheDevWay Oct 20 '16 at 09:35
  • can you please post your config/main.php file where you have set `loginUrl `component – Nitin Pund Oct 20 '16 at 10:02
  • @Nitin The login url is set somewhere in the module, the configuration file is in config/web.php, I will attach it to the question, but the application is working on my ubuntu desktop just fine with this configuration, the problem is after I deploy it to the ubuntu server. – TheDevWay Oct 20 '16 at 10:21
  • In Linux the config settings becomes case sensitive while on windows it doesn't, so you need to check your login url, also check access rule for the new user (i.e. login action is allowed for new user also) – Nitin Pund Oct 20 '16 at 10:30

1 Answers1

6

Found the solution! Sometimes if a yii2 error occurs It shows too many redirects error instead of internal server error (500), so enable debug mode from web/index.php (uncomment these two lines):

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

and you can see exactly what causes the problem.

p.s: Redirected too many times error was because the 777 permissions for runtime and assets folder were not set.

TheDevWay
  • 1,363
  • 1
  • 16
  • 45