Plesk

Unable to add “location /” to additional nginx directives for domain in Plesk: nginx: [emerg] duplicate location “/”

Symptoms

Cause

Location / is already defined in the main domain configuration file /var/www/vhosts/system/example.com/conf/nginx.conf when the Nginx service is enabled as a reverse proxy

Resolution

Note: In the case that the additional directives that are needed to be added are for enabling Permalinks from WordPress, please use this article: After switching a WordPress website to FPM served by nginx in Plesk, it fails to load with "404 Not Found" on all pages except start page

To add location / to additional nginx directives:

Create custom virtual hosts configuration templates

See the below documentation article for more details:

Changing Virtual Hosts Settings Using Configuration Templates

Warning: The changes in the virtual hosts configuration templates are applied to all domains on the server.

Disable Nginx proxy mode on the domain

  1. Log in to Plesk GUI

  2. In Domains > example.com > Apache & nginx directives temporary remove additional nginx directive containing location /;

  3. Disable Proxy Mode and click Apply

  4. Insert the necessary directive back into Additional nginx directives and click Apply

Exit mobile version