Skip to content

DDNS解析 NGINX 反向代理

约 142 字小于 1 分钟

折腾

2023-07-07

## ddns解析
	- ddns-go就行
	- 注意域名的解析设置,如果有二级域名注意*.xxx.com的解析 地址是否正确

## nginx 反向代理
	```nginx
		 server {
    listen       8999;
    server_name  127.0.0.1;
    if ($http_host ~* "^(.*?)\.386045\.xyz") {
       set $domain $1;
    }

location / {
        proxy_set_header X-Real-IP $remote_addr;

proxy_set_header Host $http_host;

if ( $domain ~* "op" ) {
            proxy_pass http://localhost;
        }
        if ( $domain ~* "pan" ) {
            proxy_pass http://localhost:8085;
        }
        if ( $domain ~* "qinglong" ) {
            proxy_pass http://localhost:5700;
        }
        if ( $domain ~* "music" ) {
            proxy_pass http://localhost:4533;
        }
        if ( $domain ~* "audiobook" ) {
            proxy_pass http://localhost:13378;
        }
        if ( $domain ~* "blog" ) {
            #proxy_pass http://localhost:520;
            root         /www/blog;
        }
         if ( $domain ~* "www" ) {
            proxy_pass http://localhost;
        }
   }
}
	```