Discourse 搭建 www域名转根域名及非www转www

0
45

1、编辑配置文件

cd /var/discourse

git pull

nano containers/app.yml

 

添加after_web_confighooks(缩进很重要用Notepad++):

hooks: after_code: - exec: cd: $home/plugins cmd: - mkdir -p plugins - git clone https://github.com/discourse/docker_manager.git after_web_config: - replace: filename: /etc/nginx/nginx.conf from: /sendfile.+on;/ to: | server_names_hash_bucket_size 64; sendfile on; - file: path: /etc/nginx/conf.d/discourse_redirect_1.conf contents: | server { listen 80; server_name example.com; return 301 $scheme://talk.example.com$request_uri; } - file: path: /etc/nginx/conf.d/discourse_redirect_2.conf contents: | server { listen 80; server_name www.example.com; return 301 $scheme://talk.example.com$request_uri; }

您可以根据需要添加多个file块,具体取决于要重定向的域数。

2、重建容器

./launcher rebuild app