• 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

Resolved nginx: [emerg] duplicate location "/"

Koda

New Pleskian
I try to input new nginx rule for seo:
location / {
index index.php;

try_files $uri $uri/ @rewrite;
}
But the / is the problem:
nginx: [emerg] duplicate location "/"

What can I don for this?
My documentroot is /httpdocs/wptd/
To change location /wptd/ givs a 404 error
 
Hi Koda,

try to use for example:
Code:
    location /wptd {
        index index.php;
        try_files $uri $uri/ @rewrite;
    }

Another option would be:
Code:
    location /wptd {
        index index.php;
        try_files $uri $uri/ /wptd/index.php?$args;
        }
 
Thank you. Sorry I have forgot the second part:
location @rewrite {
rewrite ^/(cms/|calendar/)?([^.]+)$ /$1index.php?$2 last;
}

But both of your samples givs a 404 error without any entrys in logs (only in acces ssl log)
You see the sample here: Setting up user friendly URLs - WoltLab®
I have allready try to take the htaccess converter
 
Hi Koda,

you see, it is ALWAYS better to provide ALL informations. ;)

Code:
    location ~ ^/(cms|calendar)/(.*) {
        index index.php;
        try_files $uri $uri/ /$1/index.php?$2&$args;
    }
 
Hi Koda,

how about providing ALL informations, instead of tiny little bits one after the other? If you would like help from people willing to help you, they are not able to guess your ( complete ) ".htaccess" and the additional nginx directives and suggestions may not at all suit your needs, if other directives interfere with the suggested ones.

Pls. start over again and add the complete ".htaccess" - files, additional http/https directives AND as well ALL your current additional nginx directives.
Afterwards, pls. tell us as well, what sort of content you host at the domain and in which folders. ;)
 
Thank you. At this moment I try on a completly new installation. I have no changes. What I find out:
Code:
location / {
    index index.php;
    
    try_files $uri $uri/ @rewrite;
}
location @rewrite {
    rewrite ^/(forum/|cms/|wcf/|calendar/|filebase/|blog/|gallery/)?([^.]+)$ /$1index.php?$2 last;
}
Givs 404 error

But this:
index index.php;
try_files $uri $uri/ @rewrite;
rewrite ^/(forum/|cms/|wcf/|calendar/|filebase/|blog/|gallery/)?([^.]+)$ /$1index.php?$2 last;
Work fine. Does Plesk not can Work with location under additional ngingx settings? Is this a problem or can i take this code?
 
Hi Koda,

Does Plesk not can Work with location under additional ngingx settings?
Sorry, but you miss the fact, that you are trying to use a second "location /" - directive, which is simply not possible with nginx at all, as you already noticed at your error messages. This is not a Plesk - issue or bug, it's just something that isn't possible with nginx.

Is this a problem or can i take this code?
Well, if you leave out the "location" - part, then the following directives are not set for a specific folder, but for all content in your "document root" of the (sub)domain. You might experience further issues/errors/problems, when you use other additional directives as well.
 
I must reply to this old post. Sorry.
Now I have a new test with forum and gallery as subfolder where I have not have in the last test.
This work:
www.domain.com/forum/board/2-default-forum/
This don't find the page: www.domain.com/forum/
I have try witheout /
rewrite ^/(forum|cms|wcf|calendar|filebase|blog|gallery)?([^.]+)$ /$1index.php?$2 last;
And I have try a second test

I have set a subdomain forum.domain.tld to folder forum. Now I can go to Forum Main Page. No problem.
But forum.domain.com/board/2-default-forum/ givs a redirect error
 
Hi Koda,

your issue is related to Woltlab settings for your SEO - URLs. Pls. consider to contact THEIR support ( or their community forum ;) ), because at the Plesk Community Forum we try to handle Plesk components and extensions and not any other third party components.
 
Hi Koda,

your issue is related to Woltlab settings for your SEO - URLs. Pls. consider to contact THEIR support ( or their community forum ;) ), because at the Plesk Community Forum we try to handle Plesk components and extensions and not any other third party components.
Ok thank you. I have think it was a plesk problem, because other user don't have problems with the defined rules. I will ask there
 
Back
Top