Answer the question
In order to leave comments, you need to log in
Nginx - how to make a certain pathname be a proxy for another resource?
Two containers are locally raised on the VPS:
[email protected]:~$ curl http://localhost:27073
<!DOCTYPE html><html><head><title>Express</title><link rel="stylesheet" href="/stylesheets/style.css"></head><body><h1>Welcome to Express</h1></body></html>
[email protected]:~$ curl http://localhost:50101
<!DOCTYPE html><html><head><title>App</title><link rel="stylesheet" href="/stylesheets/style.css"></head><body><h1>Welcome to App</h1></body></html>
server {
listen 80;
server_name site.com;
return 301 https://site.com$request_uri;
}
server {
listen 443 ssl;
server_name site.com;
ssl_certificate /etc/ssl/certs/cert.pem;
ssl_certificate_key /etc/ssl/private/key.pem;
location / {
proxy_pass http://127.0.0.1:27073;
}
location /apps/authors {
proxy_pass http://127.0.0.1:50101;
}
}
[email protected]:~$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[email protected]:~$ sudo systemctl restart nginx
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question