K
K
KRHD2021-01-18 01:16:11
Nginx
KRHD, 2021-01-18 01:16:11

How in Nginx to / lead to one folder, and to others - to another folder?

There is domen.ru
on the server 2 folders
one two
When entering domen.ru open folder one
When entering other routes - folder two

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
ky0, 2021-01-18
@ky0

You make two locations , the first with a strict url match /, the second with a prefix one.

V
Viktor Taran, 2021-01-18
@shambler81

location /phpmyadmin/ {
                deny all;
                return 555;
                root  /usr/share/phpmyadmin/;
        }

        location /webmail/ {
                rewrite ^/(.*)$ https://$http_host:8080/$1 permanent;
        }
        # letsencrypt
         location /.well-known/acme-challenge/ {
                alias /usr/local/ispconfig/interface/acme/;
                default_type text/plain;
         }
# default location
        location / {
                index index.php index.html index.htm;
                proxy_pass              http://127.0.0.1:82;
                proxy_set_header        Host            $host;
                proxy_set_header        X-Real-IP       $remote_addr;
                proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

Here are 4 folders and give everything in different ways.
I think for example it’s quite suitable / - this is the main directory and everything from it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question