Welcome! Log In Create A New Profile

Advanced

Problem with fastcgi_param SCRIPT_FILENAME.

Posted by bjorntj 
Problem with fastcgi_param SCRIPT_FILENAME.
April 28, 2015 04:41AM
I have setup nginx 1.8 with php-fpm support and it is working as it should, except for this small problem..
If I use:

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

I get Access denied... But using the root dir like this works:

fastcgi_param SCRIPT_FILENAME /www/domaindir$fastcgi_script_name;


Shouldn't using $document_root work or am I missing something?


Regards,

BTJ
Re: Problem with fastcgi_param SCRIPT_FILENAME.
April 28, 2015 04:58AM
It means root <> /www/domaindir

adding:
root '/www/domaindir';
should fix it.

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: Problem with fastcgi_param SCRIPT_FILENAME.
April 28, 2015 05:10AM
I already have that in my config... My config looks like this:

server {
listen 80;
server_name www.domain.no;

access_log /var/log/nginx/domain-access.log;
error_log /var/log/domain-error.log;

location / {
root /www/domaindir;
index index.php;

if (-f $request_filename) {
expires 30d;
break;
}

if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q=$1 last;
}
}

include global/restrictions.conf;

# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;

location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f /www/domaindir$fastcgi_script_name) {
return 404;
}
fastcgi_pass php;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /www/domaindir$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}


This works but when I change to $document_root, it does not...
Is there a way I can write the value of $document_root to the logfile?
Re: Problem with fastcgi_param SCRIPT_FILENAME.
April 28, 2015 05:13AM
I see a root inside 1 location block but not inside the block where you have the problem, place root at server block level or repeat it in each location block.

Add_header $docroot and use curl to see whats in it.

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: Problem with fastcgi_param SCRIPT_FILENAME.
April 28, 2015 05:16AM
Aaaah, of course... Thx... :)

BTJ
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 181
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready