nginx redirects to install.php

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
Chipie's picture

Hi,

I hope this is the right place to ask this question. I have switched from apache to nginx by using the config files from yhager on http://github.com/yhager/nginx_drupal. When accessing the site, I am redirected to install.php. How can I enable logging in order to track down the problem? Any help is appreciated.

Regards

Stéphane

Comments

To enable debugging you need

brianmercer's picture

To enable debugging you need a version of nginx compiled with debugging. I know the Ubuntu official repo version has it enabled. You can check by doing "nginx -V" and looking for "--with-debug".

Then you put a line "debug_connection 192.168.1.102;" in your /etc/nginx/nginx.conf file with your current IP address. http://www.whatismyip.com/

Then restart nginx. All the debugging info will go by default to your error.log file. You can trace the steps there. You probably want to # out the debug_connection line after because the log file can get large quickly if you access your own site much.

If you want help tracing the issue, you can post your configs here. (with identifying info redacted)

Thank you for the prompt

Chipie's picture

Thank you for the prompt reply. I have enabled debugging. Here is the output:

2010/08/18 21:21:22 [debug] 31847#0: *1 http request line: "GET / HTTP/1.1"
2010/08/18 21:21:22 [debug] 31847#0: *1 http uri: "/"
2010/08/18 21:21:22 [debug] 31847#0: *1 http args: ""
2010/08/18 21:21:22 [debug] 31847#0: *1 http exten: ""
2010/08/18 21:21:22 [debug] 31847#0: *1 http process request header line
2010/08/18 21:21:22 [debug] 31847#0: *1 http header: "Host: *"
2010/08/18 21:21:22 [debug] 31847#0: *1 http header: "Authorization: Basic dXNlcjpzZWNyZXQ="
2010/08/18 21:21:22 [debug] 31847#0: *1 http header: "User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; de-de) AppleWebKit/533.17.8 (KHTML, like Gecko) Version/5.0.1 Safari/533.17.8"
2010/08/18 21:21:22 [debug] 31847#0: *1 http header: "Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
2010/08/18 21:21:22 [debug] 31847#0: *1 http header: "Accept-Language: de-de"
2010/08/18 21:21:22 [debug] 31847#0: *1 http header: "Accept-Encoding: gzip, deflate"
2010/08/18 21:21:22 [debug] 31847#0: *1 http header: "Cookie: wooMeta=MSY5NyYxMzYmODc3NjI2OCYxMjc5Mjk0NTE3ODY2JjEyODIxNTg2MjM3MTAmJjEwMCYmNDAwMjMwJiYmJm5hbWU9c3RlcGhhbmUlNDBsdXguaW8mZW1haWw9c3RlcGhhbmUlNDBsdXguaW8m; __utmb=157479591.1.10.1282158623; __utma=157479591.1582132935.1254138278.1282150582.1282158623.94; SESSb839f23a772ad338029617d5167d5903=69717d5572cd6e10625bda06212b72f9; SESSfcc31f91186fb2df9b53dfbb1ea0ddee=39c8a0581ef71ab8594dc536a3b7208c; __utmz=157479591.1281971050.88.3.utmcsr=bing|utmccn=(organic)|utmcmd=organic|utmctr=stephane%20lux; woopraredirect=72.233.107.117; wooTracker=029YV9RFRJULI6QZWDJ8JPA5W9CZ5A22"
2010/08/18 21:21:22 [debug] 31847#0: *1 http header: "Connection: keep-alive"
2010/08/18 21:21:22 [debug] 31847#0: *1 http header done
2010/08/18 21:21:22 [debug] 31847#0: *3 accept: 88.130.87.3 fd:13
2010/08/18 21:21:22 [debug] 31847#0: *3 event timer add: 13: 60000:1282159342738
2010/08/18 21:21:22 [debug] 31847#0: *3 epoll add event: fd:13 op:1 ev:80000001
2010/08/18 21:21:22 [debug] 31847#0: *3 post event 000000001D6A4E60
2010/08/18 21:21:22 [debug] 31847#0: *3 delete posted event 000000001D6A4E60
2010/08/18 21:21:22 [debug] 31847#0: *3 malloc: 000000001D651E30:1288
2010/08/18 21:21:22 [debug] 31847#0: *3 malloc: 000000001D63CA30:256
2010/08/18 21:21:22 [debug] 31847#0: *3 malloc: 000000001D652340:1024
2010/08/18 21:21:22 [debug] 31847#0: *3 malloc: 000000001D6594F0:4096
2010/08/18 21:21:22 [debug] 31847#0: *3 http process request line
2010/08/18 21:21:22 [debug] 31847#0: *3 recv: fd:13 986 of 1024
2010/08/18 21:21:22 [debug] 31847#0: *3 http request line: "GET /install.php HTTP/1.1"

Why is the browser redirected to the install.php? How can I debug php-cgi?

Redirect to install.php

mikeytown2's picture

Odds are the permissions for your settings.php file is not readable from nginx or php depending on how you have it setup. I would check permissions

I have set the permissions

Chipie's picture

I have set the permissions for testing to 777 for all files unter sites/site and got got the same result. Could be there another reason, why php-cgi cannot access settings.php? How can I debug php-cgi?

I experienced similar things

perusio's picture

when switching from the Apache-php-as-a-module setup to nginx. This seems to be a permissions issue. Like mikeytown2 says above.

Remove the 777 permissions settings. Drupal files are not executables. I would venture that the problem is in some directory that nginx is not allowed to access due to incorrect permissions. At least that's where my problems were. Specifically nginx was not reading the settings.php hence when hitting index.php Drupal thought: "hmmm, no settings.php, I guess I need to be installed first."

safe_mode = off

Chipie's picture

Changing the file permissions did not help. After I set "safe_mode = off;" in the php.ini, everything worked fine.

deleted

Chipie's picture

deleted

I had a similar issue with my

Mojah's picture

I had a similar issue with my aegir/hostmaster setup. I have nginx and php-fpm running under the user www-data. After giving the group www-data read access to the Drupal core, the issue was resolved.
chgrp -R www-data hostmaster-6.x-1.3

Searching for a solution I

nlambert's picture

Searching for a solution I stumbled onto this page

I have nginx running on my macbook and also getting a 403 forbidden.

Changing the permissions of settings.php to 444 or even 004 solves my problem.

I also have hostmaster (aegir) installed. It automatically sets permissions to 440 to the following :

sites/example.ldev/settings.php
sites/example.ldev/files
sites/example.ldev/private

User and group of the above are "myuser" and "_www"

My nginx.conf I have set : user myuser _www;

Hope someone can help.

Cheers

What user is php running as?

brianmercer's picture

What user is php running as?

Bows to you

nlambert's picture

I'm running php-fpm. I had modified the config file, but apparently php-fpm was using ANOTHER config file. What a dummy!

I've added a symlink. Works like a charm.

Thanks so much!!!!!!

Nginx

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week