我可以通过输入 /dokuwiki 来访问容器,但是资产和链接却乱七八糟。 我目前看到的
由于 PHP 包含在 dokuwiki 容器中,我不确定需要在 nginx 配置中添加什么。我已经花了好几天的时间尝试各种配置,但毫无进展。无论如何,下面是相关详细信息,感谢您的时间。
# Contents of nginx/nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
upstream docker-adguard-home {
server adguard-home;
}
upstream docker-airsonic {
server airsonic:4040;
}
upstream docker-dokuwiki {
server dokuwiki;
}
我目前将所有服务都放在 home.conf 中,我打算在它们全部运行并强化后将其分离出来。
# contents of nginx/conf/home.conf
server {
listen 80 default_server;
listen [::]:80 default_server;
auth_basic "Authorized users only";
auth_basic_user_file /etc/apache2/.htpasswd;
server_name mydomain.ddns.org 192.168.0.22;
location /media {
root /var/www/;
autoindex on;
}
location /adguard/ {
proxy_cookie_path / /adguard/;
proxy_redirect /login.html /adguard/login.html;
proxy_pass http://docker-adguard-home/;
}
location /airsonic {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Server $host;
proxy_max_temp_file_size 0;
proxy_pass http://docker-airsonic;
add_header X-Content-Type-Options "nosniff";
add_header X-Frame-Options SAMEORIGIN;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
}
location /dokuwiki/ {
proxy_pass http://docker-dokuwiki/;
}
location / {
root /var/www/html/;
index index.html
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
如果有人想复制它,可以使用 Docker compose
version: '3'
services:
nginx:
image: nginx:1.17-alpine
container_name: nginx
restart: always
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/conf/:/etc/nginx/conf.d/:ro
- ./nginx/htpasswd:/etc/apache2/.htpasswd:ro
- ./log/nginx/:/var/log/nginx/
- ./www/html/:/var/www/html/:ro
- ./content/Music:/var/www/media/Music:ro
ports:
- 80:80
- 443:443
networks:
- reverse-proxy
adguard-home:
image: adguard/adguardhome
container_name: adguard-home
restart: always
volumes:
- ./adguard/work:/opt/adguardhome/work
- ./adguard/config:/opt/adguardhome/conf
ports:
- 53:53
- 53:53/udp
networks:
- reverse-proxy
expose:
- 80
airsonic:
image: linuxserver/airsonic
container_name: airsonic
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Dublin
- CONTEXT_PATH=/airsonic #optional
- JAVA_OPTS=-Dserver.use-forward-headers=true
volumes:
- ./airsonic/config:/config
- ./content/Music:/music:ro
- ./airsonic/playlists:/playlists
- ./airsonic/podcasts:/podcasts
restart: unless-stopped
expose:
- 4040
networks:
- reverse-proxy
dokuwiki:
image: linuxserver/dokuwiki
container_name: dokuwiki
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Dublin
#- APP_URL=/dokuwiki #optional
volumes:
- /dokuwiki:/config
networks:
- reverse-proxy
expose:
- 80
restart: unless-stopped
networks:
reverse-proxy:
driver: bridge
答案1
对于任何读到这篇文章的人来说。我最终选择了 raneto。我只需要渲染 markdown 即可。我怀疑我的问题与 php 有关,但这不再是一个问题。如果您正在寻找不使用 PHP 的平面文件 wiki,请查看。