B
B
BloodVIRUS2016-12-26 00:46:21
Nginx
BloodVIRUS, 2016-12-26 00:46:21

How to configure nginx config so that there is one admin panel for all sites?

Hello! I have a number of typical sites, more than 100, and they all have an identical control panel. Is it possible in nginx at the config level to load the contents of another folder when accessing the domain? I have such a default config for all domains: pastebin.com/R64WJKdb
I was sure that by adding the directive

location ~* ^/admin/ {
        root /var/www/url_admin.ru
    }

when accessing /admin, the admin panel will be loaded, which lies and works on url_admin.ru but does not work, gives 404 errors .. Am I forgetting to take into account something? If you create a symlink, then everything works, but I want to understand at the level of the web server.
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Shitskov, 2016-12-26
@BloodVIRUS

Do you take into account that when

location ~* ^/admin/ {
        root /var/www/url_admin.ru;
    }

Result path /var/www/url_admin.ru/admin/?
Or use alias

B
Bastax13, 2016-12-26
@Bastax13

Try adding index index.php;(if the admin is not in PHP - specify a different file extension) to get

location ~* ^/admin/ {
        root /var/www/url_admin.ru;
        index index.php;
}

And yet, do not forget to put ;at the end of the line.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question