• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

XenForo nginx friendly url's

Jay_W

New Pleskian
Hey all.

I'm trying to use nginx php-fpm on my forum, and to set friendly url's, I am told to add this to nginx config:

Code:
location / {
    try_files $uri $uri/ /index.php?$uri&$args;
    index index.php index.html;
}

location /internal_data/ {
    internal;
}
location /library/ {
       internal;
}

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_pass    127.0.0.1:9000;
    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include         fastcgi_params;
}

I try adding this using the Additional Nginx Directives, and get this error:

Code:
Invalid nginx configuration: nginx: [emerg] duplicate location "/" in /var/www/vhosts/system/domain.com/conf/vhost_nginx.conf:1 nginx: configuration file /etc/nginx/nginx.conf test failed

I think if my domain was in a folder, this wouldn't be a problem. I really don't want to change that, though.
Any idea?

Thanks.
 
Hi Jay_W,

please have a look at the current specific nginx configuation at "/var/www/vhosts/system/domain.com/conf/". You will notice, that there are already some locations defined. It is not possible to define locations twice, so you need to add additional directives either in combinations, use the Plesk 12 "htaccess to nginx" converter, or have to modify the existing nginx configuration.


Be aware that the definition "try_files $uri $uri/ /index.php?$uri&$args;" is a very common definition, which gives the possibilty to perform malware code if users are aible to upload files.
 
The nginx.conf file? It only contains this:

#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

The nginx_ip_default.conf has some contents, but also tells me not to edit.
 
Hi Jay_W,

correct, if the default domain for an IP is defined for your specific domain, that you are trying to define addtional nginx directives with, then the "nginx_ip_default.conf" is the configuration file, where you COULD modify combined standard directives, as provided in your initial post. Again... PLEASE have a look at these files and compair it with the additional directives, that you would like to define... you will see, that there are already some basic location definitions, which you tried to define again in addition - which doesn't work.

As I wrote before, you can't define additional directives, which are already defined, so the standard suggestions from XenForo have to modified by you. This is either possible over the "additional nginx directives" configuration in your webserver settings over Plesk, over the file "vhost_nginx.conf" at "/var/www/vhosts/system/domain.com/conf/" or you can modify as well the standard nginx.conf ( or nginx_ip_default.conf ). You normally don't change nginx.conf ( or nginx_ip_default.conf ), because these files might be re-generated by Plesk, when you modify your webserver - that is why you have the warning on top of the configuration files.


Additional directives are very specific and mostly don't meet standards, because they depend on your very own webserver settings - and that's again the reason, why I ask you to investigate the current nginx.conf ( or nginx_ip_default.conf ), to make sure, that you get the idea which additional directive could be added by you, if you would like to use php-fpm with your XenForo forum. Another example, why your used standard XenForo configuration won't work is the part "fastcgi_pass 127.0.0.1:9000;" ... and you will see why, if you investigate the current nginx.conf ( or nginx_ip_default.conf ).
 
Hallo,
seit meinem Update auf Plesk Onyx bekomme ich meine friendly-url's nicht mehr zum Laufen.
Ich habe eine Seite, auf der eine Xenforo-Installation läuft. (http://regio-portal.wiki)

Diese Problembeschreibung hier: https://talk.plesk.com/threads/xenforo-nginx-friendly-urls.331330/
trifft bei mir auch zu.

Jetzt sind die zusätzlichen nginx-Anweisungen ja die "offiziellen" von Xenforo (https://xenforo.com/help/friendly-urls/)...

Ich habe die Anweisungen jetzt bestimmt 20x gelesen und versucht zu verstehen, aber ich bekomme das nicht zum Laufen...
Sehe ich vor lauter Bäumen den Wald nicht?

Sorry, dass ich auf Deutsch schreibe, aber mein Englisch ist nicht das Beste, daher dachte ich: jetzt frag ich mal auf Deutsch nach...
 
Back
Top