Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加站点时能否支持应用自己的基础配置? #296

Open
jearton opened this issue Feb 18, 2024 · 1 comment
Open

添加站点时能否支持应用自己的基础配置? #296

jearton opened this issue Feb 18, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@jearton
Copy link

jearton commented Feb 18, 2024

我在添加站点时,在基础信息部分有一大堆固定的东西要配置,每次手动添加指令,有点麻烦。能否直接应用一套基础模板。比如我添加的指令有:

#------------------------------security------------------------------#
add_header X-XSS-Protection         "1; mode=block" always;
add_header X-Content-Type-Options   "nosniff" always;
add_header Referrer-Policy          "no-referrer-when-downgrade" always;
add_header Content-Security-Policy  "default-src 'self' http: https: ws: wss: data: blob: 'unsafe-inline' 'unsafe-eval'; frame-ancestors 'self';" always;
add_header Permissions-Policy       "interest-cohort=()" always;
add_header X-Frame-Options          SAMEORIGIN;

# Access to .htaccess file is prohibited
location ~ /\.ht {
    deny all;
}

还有各种静态资源缓存配置,这些配置在我的每个站点都是一样的,没必要每次都手动配置一遍。我想要定制一套自己的配置。

站点大体上应该区分一下:通用站点,纯静态站点,纯反向代理站点,默认站点。websocket应该封装为一个固定选项。产品形态上应呈现为3种视图:

  1. 纯产品化傻瓜式配置视图,只需要勾勾选选和基本输入,可参考 nginx-proxy-manager 这个国外的开源项目(傻瓜模式,适合完全没学过nginx指令的小白)
  2. 可拖拽排序的指令编辑视图,能精确控制每一条指令(进阶模式,适合对nginx有经验的人,了解每个指令的含义)
  3. 纯文本编辑框视图(高级模式,适合nginx老手)

静态站点对应的HTML/CSS/JS/图片/音频/视频/字体等文件,应支持在UI上直接上传。而不需要手动ssh到服务器上,用命令行上传或是传统的FTP上传。

@jearton jearton added the enhancement New feature or request label Feb 18, 2024
@jearton jearton changed the title 添加站点时能否支持应用自己的基础模板? 添加站点时能否支持应用自己的基础配置? Feb 18, 2024
@jearton
Copy link
Author

jearton commented Feb 20, 2024

关于静态站点的文件管理,我绑了另一个镜像搭配去实现了,这里分享一下我的 docker compose 配置:

version: '3.9'

services:
  nginx:
    image: uozi/nginx-ui:latest
    container_name: nginx
    restart: unless-stopped
    depends_on:
      - filebrowser
    networks:
      - backend
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ~/docker/nginx/conf:/etc/nginx
      - ~/docker/nginx/ui:/etc/nginx-ui
      - ~/docker/nginx/www:/var/www
      - ~/docker/nginx/log:/var/log/nginx/local
    environment:
      - TZ=Asia/Shanghai
  filebrowser:
    image: filebrowser/filebrowser:v2-s6
    container_name: nginx-filebrowser
    restart: unless-stopped
    networks:
      - backend
    volumes:
      - ~/docker/nginx:/srv/nginx
      - ~/docker/nginx-filebrowser/database:/database
      - ~/docker/nginx-filebrowser/config:/config
    environment:
      - TZ=Asia/Shanghai
      - PUID=0
      - PGID=0

networks:
  backend:
   external:
     true

在站点列表里也添加了 filebrowser 的反向代理,然后只需要进入 www 目录,在线上传网站文件就可以了,www 下的一个目录对应一个网站。
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant