mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-06-19 07:35:27 +00:00
@@ -25,7 +25,7 @@ RUN curl -sL 'https://taskfile.dev/install.sh' | sh
|
||||
COPY rootfs /
|
||||
|
||||
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 \
|
||||
&& /tmp/install-s6 "${TARGETPLATFORM}" \
|
||||
&& rm -f /tmp/install-s6 \
|
||||
|
||||
@@ -28,6 +28,7 @@ acl SSL_ports port 443
|
||||
acl Safe_ports port 80 # http
|
||||
acl Safe_ports port 81
|
||||
acl Safe_ports port 443 # https
|
||||
acl Safe_ports port 8000 # for CI testing with custom admin port
|
||||
|
||||
#
|
||||
# Recommended minimum Access Permission configuration:
|
||||
|
||||
@@ -3,6 +3,7 @@ services:
|
||||
cypress:
|
||||
environment:
|
||||
CYPRESS_stack: "postgres"
|
||||
NPM_ADMIN_PORT: 8000
|
||||
|
||||
fullstack:
|
||||
environment:
|
||||
@@ -11,11 +12,14 @@ services:
|
||||
DB_POSTGRES_USER: "npm"
|
||||
DB_POSTGRES_PASSWORD: "npmpass"
|
||||
DB_POSTGRES_NAME: "npm"
|
||||
NPM_ADMIN_PORT: 8000
|
||||
depends_on:
|
||||
- db-postgres
|
||||
- authentik
|
||||
- authentik-worker
|
||||
- authentik-ldap
|
||||
expose:
|
||||
- "8000/tcp"
|
||||
|
||||
db-postgres:
|
||||
image: postgres:17
|
||||
|
||||
@@ -105,6 +105,7 @@ services:
|
||||
environment:
|
||||
HTTP_PROXY: "squid:3128"
|
||||
HTTPS_PROXY: "squid:3128"
|
||||
NPM_ADMIN_PORT: 81
|
||||
volumes:
|
||||
- "cypress_logs:/test/results"
|
||||
- "./dev/resolv.conf:/etc/resolv.conf:ro"
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
# Admin Interface
|
||||
server {
|
||||
listen 81 default;
|
||||
listen [::]:81 default;
|
||||
listen {{NPM_ADMIN_PORT}} default;
|
||||
listen [::]:{{NPM_ADMIN_PORT}} default;
|
||||
|
||||
server_name nginxproxymanager;
|
||||
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/30-ownership.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/60-secrets.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 ...'
|
||||
|
||||
is_mounted() {
|
||||
awk -v p="$1" '$5 == p { found=1 } END { exit !found }' /proc/self/mountinfo
|
||||
}
|
||||
|
||||
process_folder () {
|
||||
FILES=$(find "$1" -type f -name "*.conf")
|
||||
SED_REGEX=
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/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
|
||||
echo "OK"
|
||||
|
||||
@@ -70,3 +70,7 @@ is_true () {
|
||||
echo '0'
|
||||
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
|
||||
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
|
||||
echo -n "."
|
||||
sleep 1
|
||||
HEALTHY="$(docker inspect -f '{{.State.Health.Status}}' $SERVICE)"
|
||||
HEALTHY="$(docker inspect -f '{{.State.Health.Status}}' "$SERVICE")"
|
||||
((LOOPCOUNT++))
|
||||
|
||||
if [ "$LOOPCOUNT" == "$LIMIT" ]; then
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { defineConfig } from 'cypress';
|
||||
import pluginSetup from '../plugins/index.mjs';
|
||||
|
||||
const adminPort = process.env.NPM_ADMIN_PORT ?? 81;
|
||||
|
||||
export default defineConfig({
|
||||
allowCypressEnv: false,
|
||||
requestTimeout: 30000,
|
||||
@@ -19,6 +21,6 @@ export default defineConfig({
|
||||
env: {
|
||||
swaggerBase: `{{baseUrl}}/api/schema?ts=${Date.now()}`,
|
||||
},
|
||||
baseUrl: "http://fullstack:81",
|
||||
baseUrl: `http://fullstack:${adminPort}`,
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user