H
H
Hazrat Hajikerimov2019-01-25 12:08:40
Nginx
Hazrat Hajikerimov, 2019-01-25 12:08:40

Nginx: Multiple projects under the same domain?

Hello guys, there is a subdomain like app.hazratgs.com, in the root directory of this subdomain there are 2 folders like googleplay and appstore, (inside the landing pages, statics) how can I configure nginx so that it gives the content of each folder?
for example, the user changed the link https://app.hazratgs.com/appstore so that the index.html of this page was given, and it would be cool if I didn’t have to rewrite the paths to the pictures, since they all link like this: /img/ favicon.png, while they are not in the root, they
did this in the folders of these landing pages:

server {
    listen 80;
    server_name _;
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    add_header X-XSS-Protection "1; mode=block";
    root /var/www/;
    index index.html;
    # Force all paths to load either itself (js files) or go through index.html.

    location / {
        try_files $uri /index.html;
    }

    location /appstore {
        root /var/www/appstore;
        try_files $uri /index.html;
    }

    location /googleplay {
        root /var/www/googleplay;
        try_files $uri /index.html;
    }
}

the question seems to be simple, but even it is not googled and is not solved (

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
Hazrat Hajikerimov, 2019-01-25
@hazratgs

The question is removed, a colleague helped, it is solved using alias:

location /prognosis-2019 {
        alias /var/www/prognosis-2019/;
    } 
    location /history-of-money {
        alias /var/www/history-of-money/;
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question