mirror of
https://github.com/jc21/nginx-proxy-manager.git
synced 2024-08-30 18:22:48 +00:00
Backend schema and migration modifications for allowing static hosts and locations
This commit is contained in:
parent
f61ab55b52
commit
8de118d875
@ -69,6 +69,9 @@ exports.up = function (knex/*, Promise*/) {
|
||||
table.json('domain_names').notNull();
|
||||
table.string('forward_ip').notNull();
|
||||
table.integer('forward_port').notNull().unsigned();
|
||||
table.string('root_dir').notNull();
|
||||
table.string('index_file').notNull();
|
||||
table.integer('static').notNull().unsigned().defaultTo(0);
|
||||
table.integer('access_list_id').notNull().unsigned().defaultTo(0);
|
||||
table.integer('certificate_id').notNull().unsigned().defaultTo(0);
|
||||
table.integer('ssl_forced').notNull().unsigned().defaultTo(0);
|
||||
|
@ -222,6 +222,11 @@
|
||||
"description": "Should we cache assets",
|
||||
"example": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"static": {
|
||||
"description": "Should the proxy point to static files",
|
||||
"example": true,
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,14 +24,22 @@
|
||||
},
|
||||
"forward_host": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"minLength": 0,
|
||||
"maxLength": 255
|
||||
},
|
||||
"forward_port": {
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"minimum": 0,
|
||||
"maximum": 65535
|
||||
},
|
||||
"root_dir": {
|
||||
"type": "string",
|
||||
"minLength": 0,
|
||||
},
|
||||
"index_file": {
|
||||
"type": "string",
|
||||
"minLength": 0,
|
||||
},
|
||||
"certificate_id": {
|
||||
"$ref": "../definitions.json#/definitions/certificate_id"
|
||||
},
|
||||
@ -53,6 +61,9 @@
|
||||
"caching_enabled": {
|
||||
"$ref": "../definitions.json#/definitions/caching_enabled"
|
||||
},
|
||||
"static": {
|
||||
"$ref": "../definitions.json#/definitions/static"
|
||||
},
|
||||
"allow_websocket_upgrade": {
|
||||
"description": "Allow Websocket Upgrade for all paths",
|
||||
"example": true,
|
||||
@ -76,10 +87,7 @@
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"forward_scheme",
|
||||
"forward_host",
|
||||
"forward_port",
|
||||
"path"
|
||||
"forward_scheme"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
@ -99,6 +107,15 @@
|
||||
"forward_port": {
|
||||
"$ref": "#/definitions/forward_port"
|
||||
},
|
||||
"root_dir": {
|
||||
"$ref": "#/definitions/root_dir"
|
||||
},
|
||||
"index_file": {
|
||||
"$ref": "#/definitions/index_file"
|
||||
},
|
||||
"static": {
|
||||
"$ref": "#/definitions/static"
|
||||
},
|
||||
"forward_path": {
|
||||
"type": "string"
|
||||
},
|
||||
@ -131,6 +148,12 @@
|
||||
"forward_port": {
|
||||
"$ref": "#/definitions/forward_port"
|
||||
},
|
||||
"root_dir": {
|
||||
"$ref": "#/definitions/root_dir"
|
||||
},
|
||||
"index_file": {
|
||||
"$ref": "#/definitions/index_file"
|
||||
},
|
||||
"certificate_id": {
|
||||
"$ref": "#/definitions/certificate_id"
|
||||
},
|
||||
@ -152,6 +175,9 @@
|
||||
"caching_enabled": {
|
||||
"$ref": "#/definitions/caching_enabled"
|
||||
},
|
||||
"static": {
|
||||
"$ref": "#/definitions/static"
|
||||
},
|
||||
"allow_websocket_upgrade": {
|
||||
"$ref": "#/definitions/allow_websocket_upgrade"
|
||||
},
|
||||
@ -204,9 +230,7 @@
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"domain_names",
|
||||
"forward_scheme",
|
||||
"forward_host",
|
||||
"forward_port"
|
||||
"forward_scheme"
|
||||
],
|
||||
"properties": {
|
||||
"domain_names": {
|
||||
@ -221,6 +245,12 @@
|
||||
"forward_port": {
|
||||
"$ref": "#/definitions/forward_port"
|
||||
},
|
||||
"root_dir": {
|
||||
"$ref": "#/definitions/root_dir"
|
||||
},
|
||||
"index_file": {
|
||||
"$ref": "#/definitions/index_file"
|
||||
},
|
||||
"certificate_id": {
|
||||
"$ref": "#/definitions/certificate_id"
|
||||
},
|
||||
@ -242,6 +272,9 @@
|
||||
"caching_enabled": {
|
||||
"$ref": "#/definitions/caching_enabled"
|
||||
},
|
||||
"static": {
|
||||
"$ref": "#/definitions/static"
|
||||
},
|
||||
"allow_websocket_upgrade": {
|
||||
"$ref": "#/definitions/allow_websocket_upgrade"
|
||||
},
|
||||
@ -294,6 +327,12 @@
|
||||
"forward_port": {
|
||||
"$ref": "#/definitions/forward_port"
|
||||
},
|
||||
"root_dir": {
|
||||
"$ref": "#/definitions/root_dir"
|
||||
},
|
||||
"index_file": {
|
||||
"$ref": "#/definitions/index_file"
|
||||
},
|
||||
"certificate_id": {
|
||||
"$ref": "#/definitions/certificate_id"
|
||||
},
|
||||
@ -315,6 +354,9 @@
|
||||
"caching_enabled": {
|
||||
"$ref": "#/definitions/caching_enabled"
|
||||
},
|
||||
"static": {
|
||||
"$ref": "#/definitions/static"
|
||||
},
|
||||
"allow_websocket_upgrade": {
|
||||
"$ref": "#/definitions/allow_websocket_upgrade"
|
||||
},
|
||||
|
@ -13,3 +13,8 @@
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
server_name {{ domain_names | join: " " }};
|
||||
{% if static == 1 or static == true %}
|
||||
root {{ root_dir }};
|
||||
index {{ index_file }};
|
||||
{% endif %}
|
||||
|
||||
|
@ -1,9 +1,16 @@
|
||||
location {{ path }} {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Scheme $scheme;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_pass {{ forward_scheme }}://{{ forward_host }}:{{ forward_port }}{{ forward_path }};
|
||||
|
||||
{% if static == 0 or static == false %}
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Scheme $scheme;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_pass {{ forward_scheme }}://{{ forward_host }}:{{ forward_port }}{{ forward_path }};
|
||||
{% else %}
|
||||
alias {{ root_dir }}/$1;
|
||||
try_files $uri /{{ index_file }} =200;
|
||||
{% endif %}
|
||||
|
||||
{{ advanced_config }}
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@ server {
|
||||
|
||||
{%- if value == "html" %}
|
||||
root /data/nginx/default_www;
|
||||
# root /var/www/test2;
|
||||
location / {
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
|
@ -52,8 +52,14 @@ server {
|
||||
proxy_http_version 1.1;
|
||||
{% endif %}
|
||||
|
||||
# Proxy!
|
||||
include conf.d/include/proxy.conf;
|
||||
{% if static == 1 or static == true %}
|
||||
alias {{ root_dir }}/$1;
|
||||
try_files $uri /{{index_file}} =200;
|
||||
{% else %}
|
||||
# Proxy!
|
||||
include conf.d/include/proxy.conf;
|
||||
|
||||
{% endif %}
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user