allow domain like 'com.example.com:8080',use external port and nginx programmer manager listen thses ports

This commit is contained in:
xialj 2023-02-13 14:33:09 +08:00
parent fd30cfe98b
commit f00fe275ca
3 changed files with 14 additions and 0 deletions

View File

@ -32,6 +32,16 @@ const internalNginx = {
return internalNginx.deleteConfig(host_type, host); // Don't throw errors, as the file may not exist at all
})
.then(() => {
boolean use_default_port = false;
let listen_ports = [];
_.each(host.domain_names, (domain_name) => {
if ( domain_name.indexOf(":") < 0 ){
host.use_default_port = true;
}else{
let listen_port = parseInt(domain_name.substring(domain_name.indexOf(":")+1));
}
});
return internalNginx.generateConfig(host_type, host);
})
.then(() => {

View File

@ -12,4 +12,7 @@
#listen [::]:443;
{% endif %}
{% endif %}
{% for listen_port in listen_ports %}
listen listen_port;
{% endfor %}
server_name {{ domain_names | join: " " }};

View File

@ -56,6 +56,7 @@ proxy_http_version 1.1;
{% if allow_websocket_upgrade == 1 or allow_websocket_upgrade == true %}
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header Host $host:$server_port;
proxy_http_version 1.1;
{% endif %}