0

nGinx Root Setting

Sean McNamara 5 years ago updated 5 years ago 2

So I have a unique problem I haven't seemed to be able to find the answer to.. Building a project with symfony components so my code is in `/srv/example` however with the way things are setup I need the web root to be `/srv/example/www` I didn't think this would be any big deal however I can't seem to change the root using Ajenti at all! Here is its default config:

server { 
    listen *:80;
server_name example.com;
access_log /var/log/nginx/example.access.log;
error_log /var/log/nginx/example.error.log;
root /srv/example;
index index.html index.htm index.php;
location ~ [^/]\.php(/|$) {
fastcgi_index index.php;
include fcgi.conf;
fastcgi_pass unix:/var/run/ajenti-v-php-fcgi-example-php-fcgi-0.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
} }
Then the config when I add `root /srv/example/www/` to the `Custom Configuration` section of the websites settings:

server {  
    listen *:80;
server_name example.com;
access_log /var/log/nginx/example.access.log;
error_log /var/log/nginx/example.error.log;
root /srv/example;
index index.html index.htm index.php; root /srv/example/www;
location ~ [^/]\.php(/|$) {
fastcgi_index index.php;
include fcgi.conf;
fastcgi_pass unix:/var/run/ajenti-v-php-fcgi-example-php-fcgi-0.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
} }

This of course causes nginx to not be able to start as there are two root definitions. For the moment I've just edited the "DO NOT EDIT" file however I need a better solution to this, is there a way to get this setting to stick or perhaps a better file to put the settings into?

Note:

It has occurred to me that changing the root in the `Website Files` to `/srv/example/www` would change the setting however then I have the problem of the FTP accounts being limited to the `/srv/example/www` which isn't what I want!


Any ideas appreciated! :)

Maybe I am misunderstanding, but do you need anything in the "Custom Configuration"? Can't you just log in to Ajenti, click "Websites", click "Manage" for the website in question, and then change the path to
/srv/example/www

@Pamela As I mentioned, that does solve the routing problem, but then I cannot upload files via the users FTP account, which isn't a solution. I would prefer to be able to override the configuration entirely if possible.