Webinoly is just the perfect tool for NGINX experts. Give it a try!
0 votes
1.4k views
by Rookie

Hey

i have to add a custom nginx parameter so that custom seo-urls will be supportet, but after adding it to the cusotm.nginx.conf file in the main directory of the homepage and after restarting nginx, i am getting a nginx error :(

this is the content of the custom nginx.conf

location / {

index index.php;

try_files $uri $uri/ @rewrite;

}

location @rewrite {

rewrite ^/(forum/|cms/|wcf/|calendar/|filebase/|blog/|gallery/)?([^.]+)$ /$1index.php?$2 last;

}

and this is the error i get:

Nov 05 15:17:41 domain.tld systemd[1]: Starting A high performance web server and a reverse proxy server...

Nov 05 15:17:41 domain.tld nginx[64761]: nginx: [emerg] duplicate location "/" in /var/www/sub.domain.tld/custom-nginx.conf:1

Nov 05 15:17:41 domain.tld nginx[64761]: nginx: configuration file /etc/nginx/nginx.conf test failed

Nov 05 15:17:41 domain.tld systemd[1]: nginx.service: Control process exited, code=exited status=1

Nov 05 15:17:41 domain.tld systemd[1]: nginx.service: Failed with result 'exit-code'.

Nov 05 15:17:41 domain.tld systemd[1]: Failed to start A high performance web server and a reverse proxy server.

i hope anyone could help me out :) 

2 Answers

0 votes
by Talented

Hi, this tells you that you have specified location / twice (:1 means in line one):

duplicate location "/" in /var/www/sub.domain.tld/custom-nginx.conf:1

so you should probably insert your stuff in the sites-available conf file where the location server block is already specified.

by Rookie

nope, doesnt work because webinoly creates the sub.domain.tld.conf in which is 

include common/phpx.conf;

 this says

# PHP NGINX CONFIGURATION

# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE Webinoly

location / {

try_files $uri $uri/ /index.php$is_args$args;

}

location ~* [^/]\.php(/|$) {

fastcgi_split_path_info ^(.+?\.php)(/.*)$;

fastcgi_param PATH_INFO $fastcgi_path_info;

if (!-f $document_root$fastcgi_script_name) { return 404; }

include fastcgi_params;

fastcgi_pass php;

}

if i comment this out, nothing works at sub.domain.tld

and moreover i thought i must not edit any file webinoly created because of data loss after any update? thats why there is this cusotm-nginx.conf in /var/www/sub.domain.tld ?

by Talented
Did you try inserting your location block instead?
What app are you trying to run on Webinoly?
by Rookie
edited by
download window appeared - i was promped to download a file called "download"
0 votes
by Rookie

You can't have location / in your custom config because location / already exists in /etc/nginx/common/wpfc.conf.

You could try editing /etc/nginx/common/wpfc.conf and add your code into the location / block there. But the file might get overwritten if you update webinoly in the future.

Welcome to the Community site for Webinoly.

Our Optimized LEMP Web Server is a powerful set of commands for doing just about anything you could wish.

With Webinoly you can set up your NGINX web server in just one step.

* * * * * * *

To report a bug, please create a new issue on GitHub or ask a question here with the bug tag.
Webinoly Support Paypal Donations

PayPal · GitHub Sponsors · Bitcoin

It is very important that any visitor to the site read the disclaimer, terms of use and privacy and legal statement before start browsing.

...