Создать еще один server и указать в нем другой локейшен. Например на другом порте.
Первый ресурс
server {
listen 80;
server_name service.site.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name service.site.com;
include /etc/nginx/ssl.conf;
# HTTP
location / {
proxy_pass http://127.0.0.1:9090/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
}
}
Второй ресурс
server {
listen 80;
server_name anotherservice.site.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name anotherservice.site.com;
include /etc/nginx/ssl.conf;
# HTTP
location / {
proxy_pass http://127.0.0.1:9091/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
}
}