0
Completed

How can i set my config for my website in Nginx Server?

Krzysztof Bednarczyk 5 years ago • updated by Eugene Pankov (Project coordinator) 5 years ago 4
Where i should put my config declarations for my website? I want to put this:
index index.php;
error_page 404 /Page/System/404/;
error_page 403 /403/;
autoindex off;
location / {
  if (-e $request_filename){
    rewrite ^/(.+).css$ /min/css.php?file=$request_filename break;
  }
  if (!-e $request_filename){
    rewrite ^/(.+) /xv.php/$1 break;
  }
}
location ~ ^(.*)\.(tpl|sql|tmp|config)$ {
  deny all;
}
But this didn't working on ajenti.

Answer

Answer
Completed
Putting stuff in General > Custom Configuration will append it to the server { ... } directive. Put your index, error_page, location-deny configuration there. For your location /, put the rewrite configuration into Content > / > Custom Configuration, and it will be inserted into respective generated location { ... } block.
GOOD, I'M SATISFIED
yeah, thank you! :)
Satisfaction mark by Krzysztof Bednarczyk 5 years ago
Answer
Completed
Putting stuff in General > Custom Configuration will append it to the server { ... } directive. Put your index, error_page, location-deny configuration there. For your location /, put the rewrite configuration into Content > / > Custom Configuration, and it will be inserted into respective generated location { ... } block.
How do I have to put "location / " into the Custom Configuration? Nginx says duplicate location...
If you already have "/" location in Content, put your location settings into Content > (content entry) > Advanced > Custom configuration instead.
Actually I have the same problem, even putting my custom config into its place, Ajenti overwrites the content, for example, I can not remove the "index index.html..." part, Ajenti puts it automaticaly, the same with location / even if I put my custom stuff, ajenti puts it's default stuff so I get duplicated things and that... weird
Now a "use custom configuration ONLY" option is available in Location settings.