#1040: Configuration of an SEO-optimized Swarmica public portal
Отредактирована: сегодняThis article applies to outdated versions of Swarmica. Starting from version 5.2.0, the SEO-optimized portal is automatically configured right after the initial installation
Starting from version v5.2.0, Swarmica allows you to configure a public knowledge base portal in an SEO-optimized version, which improves indexing by search engines and allows you to further configure SEO parameters, such as Open Graph data, etc.
Default configuration
If you have a default configuration in which Swarmica handles both HTTP and HTTPS connections, then follow these steps:
1 - Install Swarmica version v5.2.x or higher
2 - Set the following variable values in /root/swarmica/.env:
# Version of helpcenter, corresponds to Swarmica version, for example for v6.0.0:
SW_HELPCENTER_VERSION=v6.0.0
#
NEXT_PUBLIC_HELPCENTER_SERVER_API_URL=http://django:5000
# The django address must be added to DJANGO_ALLOWED_HOSTS:
DJANGO_ALLOWED_HOSTS=django,my.swarmica.tld
# The flag INSECURE_HTTP_SERVER=1 must be enabled
INSECURE_HTTP_SERVER=1
3 - Check the configuration of the helpcenter container in docker-compose.yml:
helpcenter:
image: reg.gl.swd.im/swarmica/helpcenter:${SW_HELPCENTER_VERSION}
restart: always
depends_on:
- django
env_file:
- .env
volumes:
- .env:/app/.env
labels:
- "traefik.enable=true"
- "traefik.http.services.helpcenter.loadbalancer.server.port=4000"
- "traefik.http.routers.helpcenter-router.rule=Host(`${SW_HOSTNAME}`) && (PathPrefix(`/category`)||PathRegexp(`^/article/.*$`)||PathPrefix(`/_next`)||PathPrefix(`/help`)||Path(`/robots/sitemap.xml`)||Path(`/llms.txt`)||Path(`/llms-full.txt`))"
- "traefik.http.routers.helpcenter-router.priority=11"
- "traefik.http.routers.helpcenter-router.entrypoints=web-secure"
- "traefik.http.routers.helpcenter-router.middlewares=secure-headers,compression"
- "traefik.http.routers.helpcenter-router.service=helpcenter"
- "traefik.http.routers.helpcenter-router.tls.certresolver=letsencrypt"
4 - Pull the images and restart the application:
docker compose pull
docker compose down
docker compose up -d
Installation behind an L7 load balancer
If your Swarmica is installed behind an external load balancer that terminates the HTTPS connection, and Swarmica handles only HTTP, then the configuration is slightly different
1 -Install Swarmica version v5.3.x or higher:
2 - Set the following variable values in /root/swarmica/.env:
# Version of helpcenter, corresponds to Swarmica version, for example for v6.0.0:
SW_HELPCENTER_VERSION=v6.0.0
# The API address for the help center must be set to http://django:5000
NEXT_PUBLIC_HELPCENTER_SERVER_API_URL=http://django:5000
# The django address must be added to DJANGO_ALLOWED_HOSTS:
DJANGO_ALLOWED_HOSTS=django,my.swarmica.tld
# The flag INSECURE_HTTP_SERVER=1 must be enabled
INSECURE_HTTP_SERVER=1
3 - Check the helpcenter container configuration in docker-compose.yml (differs in that it has a different entrypoint - web, and no secure-headers middleware):
helpcenter:
image: reg.gl.swd.im/swarmica/helpcenter:${SW_HELPCENTER_VERSION}
restart: always
depends_on:
- django
env_file:
- .env
volumes:
- .env:/app/.env
labels:
- "traefik.enable=true"
- "traefik.http.services.helpcenter.loadbalancer.server.port=4000"
- "traefik.http.routers.helpcenter-router.rule=Host(`${SW_HOSTNAME}`) && (PathPrefix(`/category`)||PathRegexp(`^/article/.*$`)||PathPrefix(`/_next`)||PathPrefix(`/help`)||Path(`/robots/sitemap.xml`)||Path(`/llms.txt`)||Path(`/llms-full.txt`))"
- "traefik.http.routers.helpcenter-router.priority=11"
- "traefik.http.routers.helpcenter-router.entrypoints=web"
- "traefik.http.routers.helpcenter-router.middlewares=compression"
- "traefik.http.routers.helpcenter-router.service=helpcenter"
4 - Pull the images and restart the application:
docker compose pull
docker compose down
docker compose up -d