Stupid newbie question (PHP's document_root in nginx and apache)

Hi,

Nginx is working fine for me, serves PHP through fast-cgi, all is
cool. But, the code i working on runs both on nginx and apache, so i’m
running into trouble.
Specificaly, using this PHP-code:

<?php print "documento root: ".$_SERVER['DOCUMENT_ROOT']; ?>

…will output in
nginx 0.6.34: /var/www/nginx-default
apache 2.2.3: /var/www/pea/
Both with PHP5

Yes, different paths, since they’re on two different machines. Both
are running Debian unstable. My problem is the end / that nginx
doesn’t have and apache does. Is there a basic fix for this? Is there
a standard? I’m using nginx as my test server and eventually i’ll try
to replace apache on the other machine, but i’d like to grok the beast
first.

This is my /etc/nginx/nginx.conf

user www-data;
worker_processes 1;

error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}

http {
root /var/www/nginx-default;
include /etc/nginx/mime.types;
default_type application/octet-stream;

access_log  /var/log/nginx/access.log;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;
tcp_nodelay        on;

gzip  on;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

}

And my /etc/nginx/fastcgi_params

fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
#fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param SERVER_SOFTWARE none;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
#fastcgi_param SERVER_NAME $server_name;
fastcgi_param SERVER_NAME none;

PHP only, required if PHP was built with --enable-force-cgi-redirect

fastcgi_param REDIRECT_STATUS 200;

How can i check this force-redirect thing? Through phpinfo()? Sorry
for the basic question but i couldn’t really find anything useful and
#nginx on freenode right now has 70 non-persons. Is there a thorough
manual i can RTFM to fiddle eficiently with the conf file?

TIA,

Nuno Magalhães
LU#484677

Here you go:

http {
root /var/www/nginx-default; # this is document root in nginx.

}

On Wed, Feb 18, 2009 at 11:57 AM, Robert G. [email protected]
wrote:

Here you go:

http {
root /var/www/nginx-default; # this is document root in nginx.

That’s what i already had, and i had tried ending it with /, didn’t
work in the conf file. I ended up going to the fastcgi_params files
and add the / to the end of $document_root. Now it works.

I still don’t know what’s standard. Anyone? Is this common?

Nuno Magalhães
LU#484677

Nuno Magalhães wrote:

On Wed, Feb 18, 2009 at 11:57 AM, Robert G. [email protected]
wrote:

Here you go:

http {
root /var/www/nginx-default; # this is document root in nginx.

That’s what i already had, and i had tried ending it with /, didn’t
work in the conf file. I ended up going to the fastcgi_params files
and add the / to the end of $document_root. Now it works.

I still don’t know what’s standard. Anyone? Is this common?

Nuno Magalhães
LU#484677

But I dont get your point, why end it with “/”. What cant u just use it
as it is?!

Sorry I got it now, but dont really know how to help u.