Support

Admin Tools

#20024 nginx.conf error "fastcgi_pass not allowed here"

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by kinwolf on Thursday, 08 May 2014 12:22 CDT

kinwolf
 Hi,

I am trying the NginX Configuration Maker but when I restart the nginx service I always get a Fail. In the error log I get this error: [emer] fastcgi_pass is not allowed here in *path to nginx.conf* :182

Line 182 indeed use fastcgi. It's the Advanced server Protection rules section.

Anything I should enable to allow this?

Thanks

nicholas
Akeeba Staff
Manager
It seems like you are putting the rules (or the include line) outside your site definition. Please remember, the rules generated by NginX Configuration Maker must be inside a "server" block, e.g.
server {
    # Your existing configuration lines go from here...
    server_name example.com;
    access_log /srv/www/example.com/logs/access.log;
    error_log /srv/www/example.com/logs/error.log;
    # ...until here.

    # NginX Configuration Maker lines go from here...
    include "/srv/www.example.com/www/nginx.conf";
    # ...until here.
    # Note: It's safer NOT to use include. Instead, paste the configuration lines between the marks.
}

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

kinwolf
Found the error.

In the .conf file admin tools create, Here is the line it creates

######################################################################
## Advanced server protection rules exceptions
######################################################################location = /administrator\/components\/com_akeeba\/restore\.php {


Notice that "location=" is on the commented line.

After I fixed this, I got another critical error preventing the service from starting. The log says location = / is duplicated.

The following lines were the problem
location = / {
	rewrite ^ /index.php last;
}


Those lines are even written twice in the .conf file. I had to comment both block out.

Then I got another error saying
location = /index.php was duplicated.
So, in the end, I had to comment all those lines out
# Allow access to the front-end index.php file
#location = / {
#	rewrite ^ /index.php last;
#}
#location = / {
#	rewrite ^ /index.php last;
#}
#location = /index.php {
#	fastcgi_pass $fastcgi_pass;
#	break;
#}


I checked my website .conf file and server block and those are not defined, so where could they already be declared?

kinwolf
Ok, I restarted from scratch. With only my .conf it works fine. then I ask admin tools to create a conf file, and I add the reference to admin tools nginx.conf to my .conf file.

Once more I get this problem

######################################################################
## Advanced server protection rules exceptions
######################################################################location = /administrator\/components\/com_akeeba\/restore\.php {


So, there is a small bug in the way it creates that line. I fix it, then again I get errors for duplicates line for
location = /

and
location = /index.php


and the code block
location = / {
	rewrite ^ /index.php last;
}
location = / {
	rewrite ^ /index.php last;
}


is really duplicated in the file admin tools creates.

When I comment all those out, I get another error, but I will open a new ticket for that one.

Thanks

kinwolf
I think I found the duplicate. In admin tools .conf file there are those lines for SEF

## Enable SEF URLs
location = / {
	try_files $uri $uri/ /index.php?$args;
}
location = /index.php {
	fastcgi_pass $fastcgi_pass;
	break;
}

nicholas
Akeeba Staff
Manager
Normally you should remove any existing SEF rules (e.g. the ones Joomla! tells you to use) when you are using Admin Tools' nginx.conf file.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

kinwolf
Hi,

The line specified above are all from admin tools file. I have attached the .conf file that admin tools create(unmodified, so you can see all the errors mentionned above)

I have also included my conf file where the server block is defined so you can see the duplicated lines do not come from there.

Thanks

kinwolf
Sent the wrong(old) files, here are the right ones.

nicholas
Akeeba Staff
Manager
Can we keep the conversation in one place? I propose keeping it to https://www.akeebabackup.com/support/admin-tools/20025-nginx-conf-error-unknown-fastcgi-pass-variable.html

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

kinwolf
No problem.

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!