Applicable to:
- Plesk for Linux
Symptoms
Adding location / to Domains > example.com > Apache & nginx > Additional nginx directives fails
Invalid nginx configuration: nginx: [emerg] duplicate location "/" in /data/www/system/example.com/conf/vhost_nginx.conf:1 nginx: configuration file /etc/nginx/nginx.conf test failed
Cause
The location / is already defined in the main domain configuration file when nginx is set up as a reverse proxy.
Resolution
Note: If the directives are for enabling WordPress permalinks, use this article: 404 Not Found after switching WordPress to FPM by nginx
To add location / to additional nginx directives:
- Log in to Plesk GUI
- Go to Domains > example.com > Hosting & DNS > Apache & nginx directives
- Temporarily remove the additional nginx directive that has
location / - Disable Proxy Mode and click Apply
- Go to Domains > example.com > Dashboard > PHP
- Untick the box PHP support
- Add the directive back to Additional nginx directives and click Apply
The following documentation shows how to create custom templates for the virtual hosts:
Changing Virtual Hosts Settings Using Configuration Templates
Warning: The changes in the virtual hosts configuration templates are applied to all domains on the server.
Comments
Please sign in to leave a comment.