Warm tip: This article is reproduced from serverfault.com, please click

apache rewrite rule for http_host containing port

发布于 2020-11-29 14:38:55

In the local network, I have synology server with a number of services running in docker on different ports and accessible in-browser like that 192.168.1.2:8989 or server.spb.lan:8989

How to make a rewrite rule to convert them like that 192.168.1.2/servicename or server.spb.lan/servicename?

Like that

192.168.1.2:8989     ->  192.168.1.2/servicename
server.spb.lan:8989  ->  server.spb.lan/servicename
Questioner
schel4ok
Viewed
0
schel4ok 2020-12-14 02:03:03

I couldn't solve the issue with apache installed directly on Synology. So I deleted it, deleted web station. Then I install nginx in docker. Synology has integrated nginx running on port 80, which cannot be deleted and there is no access to its settings. So I just mapped internal port 80 of nginx container to port 82 on Synology, make forward port 80 from router to port 82 on Synology. And then in config of nginx container I did simply that for each of my app running in docker

server {
    server_name sonarr.lan;
    location / {
        proxy_pass http://192.168.1.2:8989;
    }
}