linux:docker:disable-caddy-searxng-apache
Table of Contents
Disable Caddy in SearXNG and use Apache instead as Reverse Proxy
Configure SearXNG to use Apache as reverse proxy instead of Caddy in Oracle Linux 8. This guide shows how to safely disable the Caddy container and configure Apache for SearXNG access.
Main Steps
# Stop and remove Caddy container docker-compose stop caddy docker-compose rm caddy # Edit docker-compose.yml to remove Caddy service # (see Docker Compose Changes section below) # Restart all containers to apply changes docker-compose down docker-compose up -d
Docker Compose Changes
Remove or comment out the entire Caddy service section from docker-compose.yml:
# services: # caddy: # container_name: caddy # image: caddy:2-alpine # network_mode: host # volumes: # - ./Caddyfile:/etc/caddy/Caddyfile:ro # - caddy_data:/data # - caddy_config:/config
Apache Configuration
Create two VirtualHost configurations for HTTP and HTTPS:
<VirtualHost *:80> ServerName search.yourdomain.com Redirect permanent / https://search.yourdomain.com/ </VirtualHost> <VirtualHost *:443> ServerName search.yourdomain.com SSLEngine on SSLCertificateFile /etc/letsencrypt/live/search.yourdomain.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/search.yourdomain.com/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf ProxyPreserveHost On ProxyPass / http://127.0.0.1:8888/ ProxyPassReverse / http://127.0.0.1:8888/ ErrorLog /var/log/httpd/search.yourdomain.com_error.log CustomLog /var/log/httpd/search.yourdomain.com_access.log combined </VirtualHost>
Verification
Test the configuration:
# Check Apache syntax sudo apachectl configtest # Restart Apache sudo systemctl restart httpd # Verify SearXNG is accessible curl -I https://search.yourdomain.com
- Make sure mod_proxy, mod_proxy_http, and mod_ssl are enabled in Apache
- Ensure Let's Encrypt certificates are properly installed
- Update SELinux settings if needed: setsebool -P httpd_can_network_connect 1
- Remove or rename Caddyfile to avoid confusion
- Update firewall rules if necessary (ports 80 and 443)
- Backup docker-compose.yml before making changes
- The SearXNG container should be configured to listen on port 8888
linux/docker/disable-caddy-searxng-apache.txt · Last modified: 2025/01/03 21:44 by odefta