Podman容器中Nginx部署MkDocs无法加载theme.css求助
问题:MkDocs文档部署到Podman容器的Nginx后仅显示纯HTML无样式
我在Podman容器内的Nginx服务器上部署MkDocs文档,容器与Nginx运行正常,可访问站点且所有HTML文件均可读取,但页面仅显示纯HTML格式,无MkDocs的图形/UI样式(本地使用mkdocs serve运行时一切正常)。
容器Containerfile配置
FROM ubuntu:22.04 #Copying MkDocs files COPY /Kubernetes/site /usr/share/mkdocs-site #Installing nginx RUN apt update && \ apt -y install nginx && \ #Switching out the default nginx.conf file for the correct one RUN rm /etc/nginx/nginx.conf COPY /nginx/nginx.conf /etc/nginx EXPOSE 8080 #restarting nginx so the .conf file is reloaded RUN mkdir /usr/share/nginx-log RUN touch /usr/share/nginx-log/nginx.log CMD service nginx restart && tail -F /usr/share/nginx-log/nginx.log
(我知道有多处可优化,但应该不影响Nginx站点?)
Nginx配置(nginx.conf)
user www-data; worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { worker_connections 768; #multi_accept on; } http { server { location /mkdocs-site/ { autoindex on; root /usr/share; } } }
(服务器运行正常,应该不是此处问题)
MkDocs配置(mkdocs.yml)
site_name: oss-k8s-documentation site_url: "" nav: - Change Management: - Custom Requirement: Custom_requirement.md ... - Misc: - Adding new Clusters to Rancher: adding_new_clusters_to_rancher.md ... - Images - Alerting Installation: alerting_installation_1.png theme: readthedocs
(因无法复制完整代码,此处未列出全部内容)
我已检查MkDocs构建过程未发现异常,尝试过现有指南及自行排查,恳请各位帮忙分析页面样式异常的原因。
内容的提问来源于stack exchange,提问作者Lu1sG4
相关产品推荐
相关产品推荐

