Answer the question
In order to leave comments, you need to log in
How to redirect from a subdomain to a directory using Nginx?
Very short config, only important:
upstream keeper_app {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name domain.dev www.domain.dev;
proxy_set_header Host domain.dev;
access_log /var/log/nginx/domain.ru/access.log combined;
error_log /var/log/nginx/domain.ru/error.log warn;
resolver 127.0.0.1;
root /var/www/domain.ru;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location /api/ {
proxy_pass http://keeper_app;
}
}
http://domain.ru/api/(.*)
to the Node.js server works. And how to make requests look like api.domain.ru/(.*) ?
Answer the question
In order to leave comments, you need to log in
server {
listen 80;
server_name api.domain.dev;
location / {
proxy_set_header Host domain.dev;
proxy_pass http://keeper_app/api/;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question