mirror of
https://github.com/Alvin-Zilverstand/nginx-proxy-manager.git
synced 2026-12-01 02:17:50 +01:00
1 parent
a5db5ed156
commit
a62c2a6dc3
13 files changed
+67
-10
No files matched your search
@@ -25,7 +25,7 @@ RUN curl -sL 'https://taskfile.dev/install.sh' | sh
|
|||||||
COPY rootfs /
|
COPY rootfs /
|
||||||
|
|
||||||
COPY scripts/install-s6 /tmp/install-s6
|
COPY scripts/install-s6 /tmp/install-s6
|
||||||
RUN rm -f /etc/nginx/conf.d/production.conf \
|
RUN rm -f /etc/nginx/conf.d/production.conf.template \
|
||||||
&& chmod 644 /etc/logrotate.d/nginx-proxy-manager \
|
&& chmod 644 /etc/logrotate.d/nginx-proxy-manager \
|
||||||
&& /tmp/install-s6 "${TARGETPLATFORM}" \
|
&& /tmp/install-s6 "${TARGETPLATFORM}" \
|
||||||
&& rm -f /tmp/install-s6 \
|
&& rm -f /tmp/install-s6 \
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ acl SSL_ports port 443
|
|||||||
acl Safe_ports port 80 # http
|
acl Safe_ports port 80 # http
|
||||||
acl Safe_ports port 81
|
acl Safe_ports port 81
|
||||||
acl Safe_ports port 443 # https
|
acl Safe_ports port 443 # https
|
||||||
|
acl Safe_ports port 8000 # for CI testing with custom admin port
|
||||||
|
|
||||||
#
|
#
|
||||||
# Recommended minimum Access Permission configuration:
|
# Recommended minimum Access Permission configuration:
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ services:
|
|||||||
cypress:
|
cypress:
|
||||||
environment:
|
environment:
|
||||||
CYPRESS_stack: "postgres"
|
CYPRESS_stack: "postgres"
|
||||||
|
NPM_ADMIN_PORT: 8000
|
||||||
|
|
||||||
fullstack:
|
fullstack:
|
||||||
environment:
|
environment:
|
||||||
@@ -11,11 +12,14 @@ services:
|
|||||||
DB_POSTGRES_USER: "npm"
|
DB_POSTGRES_USER: "npm"
|
||||||
DB_POSTGRES_PASSWORD: "npmpass"
|
DB_POSTGRES_PASSWORD: "npmpass"
|
||||||
DB_POSTGRES_NAME: "npm"
|
DB_POSTGRES_NAME: "npm"
|
||||||
|
NPM_ADMIN_PORT: 8000
|
||||||
depends_on:
|
depends_on:
|
||||||
- db-postgres
|
- db-postgres
|
||||||
- authentik
|
- authentik
|
||||||
- authentik-worker
|
- authentik-worker
|
||||||
- authentik-ldap
|
- authentik-ldap
|
||||||
|
expose:
|
||||||
|
- "8000/tcp"
|
||||||
|
|
||||||
db-postgres:
|
db-postgres:
|
||||||
image: postgres:17
|
image: postgres:17
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
HTTP_PROXY: "squid:3128"
|
HTTP_PROXY: "squid:3128"
|
||||||
HTTPS_PROXY: "squid:3128"
|
HTTPS_PROXY: "squid:3128"
|
||||||
|
NPM_ADMIN_PORT: 81
|
||||||
volumes:
|
volumes:
|
||||||
- "cypress_logs:/test/results"
|
- "cypress_logs:/test/results"
|
||||||
- "./dev/resolv.conf:/etc/resolv.conf:ro"
|
- "./dev/resolv.conf:/etc/resolv.conf:ro"
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
# Admin Interface
|
# Admin Interface
|
||||||
server {
|
server {
|
||||||
listen 81 default;
|
listen {{NPM_ADMIN_PORT}} default;
|
||||||
listen [::]:81 default;
|
listen [::]:{{NPM_ADMIN_PORT}} default;
|
||||||
|
|
||||||
server_name nginxproxymanager;
|
server_name nginxproxymanager;
|
||||||
root /app/frontend;
|
root /app/frontend;
|
||||||
@@ -17,6 +17,7 @@ fi
|
|||||||
. /etc/s6-overlay/s6-rc.d/prepare/20-paths.sh
|
. /etc/s6-overlay/s6-rc.d/prepare/20-paths.sh
|
||||||
. /etc/s6-overlay/s6-rc.d/prepare/30-ownership.sh
|
. /etc/s6-overlay/s6-rc.d/prepare/30-ownership.sh
|
||||||
. /etc/s6-overlay/s6-rc.d/prepare/40-dynamic.sh
|
. /etc/s6-overlay/s6-rc.d/prepare/40-dynamic.sh
|
||||||
|
. /etc/s6-overlay/s6-rc.d/prepare/45-admin-port.sh
|
||||||
. /etc/s6-overlay/s6-rc.d/prepare/50-ipv6.sh
|
. /etc/s6-overlay/s6-rc.d/prepare/50-ipv6.sh
|
||||||
. /etc/s6-overlay/s6-rc.d/prepare/60-secrets.sh
|
. /etc/s6-overlay/s6-rc.d/prepare/60-secrets.sh
|
||||||
. /etc/s6-overlay/s6-rc.d/prepare/90-banner.sh
|
. /etc/s6-overlay/s6-rc.d/prepare/90-banner.sh
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#!/command/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
# This command reads the `NPM_ADMIN_PORT` env var and will fall
|
||||||
|
# back to 81 if this is not set or is not a number.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
log_info 'Admin Port ...'
|
||||||
|
|
||||||
|
NPM_ADMIN_PORT="${NPM_ADMIN_PORT:-81}"
|
||||||
|
# ensure admin port is a number
|
||||||
|
if ! [[ "$NPM_ADMIN_PORT" =~ ^[0-9]+$ ]]; then
|
||||||
|
echo "WARNING: NPM_ADMIN_PORT must be a number. Defaulting to 81" >&2
|
||||||
|
NPM_ADMIN_PORT=81
|
||||||
|
fi
|
||||||
|
|
||||||
|
PRODFILE="/etc/nginx/conf.d/production.conf"
|
||||||
|
SED_REGEX="s/\{\{NPM_ADMIN_PORT\}\}/${NPM_ADMIN_PORT}/g"
|
||||||
|
|
||||||
|
if is_mounted "$PRODFILE"; then
|
||||||
|
echo "WARNING: skipping ${PRODFILE} — mounted file" >&2
|
||||||
|
elif [ -f "$PRODFILE.template" ]; then
|
||||||
|
if sed -E "$SED_REGEX" "$PRODFILE.template" > "$PRODFILE" && [ -s "$PRODFILE" ]; then
|
||||||
|
# success
|
||||||
|
log_info "Generated ${PRODFILE} from template"
|
||||||
|
else
|
||||||
|
log_fatal "Failed to generate ${PRODFILE} from template"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
@@ -8,10 +8,6 @@ set -e
|
|||||||
|
|
||||||
log_info 'IPv6 ...'
|
log_info 'IPv6 ...'
|
||||||
|
|
||||||
is_mounted() {
|
|
||||||
awk -v p="$1" '$5 == p { found=1 } END { exit !found }' /proc/self/mountinfo
|
|
||||||
}
|
|
||||||
|
|
||||||
process_folder () {
|
process_folder () {
|
||||||
FILES=$(find "$1" -type f -name "*.conf")
|
FILES=$(find "$1" -type f -name "*.conf")
|
||||||
SED_REGEX=
|
SED_REGEX=
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
OK=$(curl --silent http://127.0.0.1:81/api/ | jq --raw-output '.status')
|
OK=$(curl --silent "http://127.0.0.1:${NPM_ADMIN_PORT:-81}/api/" | jq --raw-output '.status')
|
||||||
|
|
||||||
if [ "$OK" == "OK" ]; then
|
if [ "$OK" == "OK" ]; then
|
||||||
echo "OK"
|
echo "OK"
|
||||||
|
|||||||
@@ -70,3 +70,7 @@ is_true () {
|
|||||||
echo '0'
|
echo '0'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_mounted() {
|
||||||
|
awk -v p="$1" '$5 == p { found=1 } END { exit !found }' /proc/self/mountinfo
|
||||||
|
}
|
||||||
@@ -248,3 +248,21 @@ On startup, we generate a resolvers directive for Nginx unless this is defined:
|
|||||||
|
|
||||||
In this configuration, all DNS queries performed by Nginx will fall to the `/etc/hosts` file
|
In this configuration, all DNS queries performed by Nginx will fall to the `/etc/hosts` file
|
||||||
and then the `/etc/resolv.conf`.
|
and then the `/etc/resolv.conf`.
|
||||||
|
|
||||||
|
|
||||||
|
## Changing the Admin UI port from 81 to something else
|
||||||
|
|
||||||
|
First, add an env var to your docker compose file:
|
||||||
|
```yml
|
||||||
|
environment:
|
||||||
|
NPM_ADMIN_PORT: '8000'
|
||||||
|
```
|
||||||
|
|
||||||
|
And you'll probably want to expose that port as well
|
||||||
|
|
||||||
|
```yml
|
||||||
|
ports:
|
||||||
|
- '8000:8000'
|
||||||
|
```
|
||||||
|
|
||||||
|
Then you'll be able to access admin UI at `http://localhost:8000`
|
||||||
@@ -19,7 +19,7 @@ echo -e "${BLUE}❯ ${CYAN}Waiting for healthy: ${YELLOW}${SERVICE}${RESET}"
|
|||||||
until [ "${HEALTHY}" = "healthy" ]; do
|
until [ "${HEALTHY}" = "healthy" ]; do
|
||||||
echo -n "."
|
echo -n "."
|
||||||
sleep 1
|
sleep 1
|
||||||
HEALTHY="$(docker inspect -f '{{.State.Health.Status}}' $SERVICE)"
|
HEALTHY="$(docker inspect -f '{{.State.Health.Status}}' "$SERVICE")"
|
||||||
((LOOPCOUNT++))
|
((LOOPCOUNT++))
|
||||||
|
|
||||||
if [ "$LOOPCOUNT" == "$LIMIT" ]; then
|
if [ "$LOOPCOUNT" == "$LIMIT" ]; then
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { defineConfig } from 'cypress';
|
import { defineConfig } from 'cypress';
|
||||||
import pluginSetup from '../plugins/index.mjs';
|
import pluginSetup from '../plugins/index.mjs';
|
||||||
|
|
||||||
|
const adminPort = process.env.NPM_ADMIN_PORT ?? 81;
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
allowCypressEnv: false,
|
allowCypressEnv: false,
|
||||||
requestTimeout: 30000,
|
requestTimeout: 30000,
|
||||||
@@ -19,6 +21,6 @@ export default defineConfig({
|
|||||||
env: {
|
env: {
|
||||||
swaggerBase: `{{baseUrl}}/api/schema?ts=${Date.now()}`,
|
swaggerBase: `{{baseUrl}}/api/schema?ts=${Date.now()}`,
|
||||||
},
|
},
|
||||||
baseUrl: "http://fullstack:81",
|
baseUrl: `http://fullstack:${adminPort}`,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user