Skip to content

How to replace a domain in the Remnawave panel

This guide will help you change the current domain of the Remnawave panel (for example, olddomain.com) to a new one (for example, newdomain.com). You will learn how to generate a new SSL certificate and update configuration files. If you are using the panel together with a node, additional steps are provided at the end.

Generating a new SSL certificate

To use the new domain, you need to generate a new SSL certificate using the script

  1. Run the script:

    Terminal window
    remnawave_reverse
  2. Select option 8: Domain certificate management

  3. In the submenu select option 2: Generate new certificates for another domain

  4. Enter the new domain, for example, newdomain.com

  5. Select the method of obtaining the certificate: ACME or Cloudflare

  6. After successful execution, the certificates for the new domain will appear in the following directory:

    • Directory/etc/letsencrypt/ - root directory of certificates
      • Directorylive
        • Directorynewdomain.com - new domain
          • fullchain.pem
          • privkey.pem
        • Directoryolddomain.com - old domain
          • fullchain.pem
          • privkey.pem

Updating configuration files

After generating the certificate, update the domain in the Remnawave panel configuration files.

  1. Open the .env file for editing:

    Terminal window
    nano /opt/remnawave/.env
  2. Find the line with the current domain:

    .env
    FRONT_END_DOMAIN=olddomain.com
  3. Replace it with the new domain:

    .env
    FRONT_END_DOMAIN=newdomain.com
  4. Open the docker-compose.yml file:

    Terminal window
    nano /opt/remnawave/docker-compose.yml
  5. Find the remnawave-nginx service and update the paths to the certificates, replacing olddomain.com with newdomain.com:

    docker-compose.yml
    remnawave-nginx:
    image: nginx:1.28
    container_name: remnawave-nginx
    hostname: remnawave-nginx
    restart: always
    volumes:
    - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
    - /etc/letsencrypt/live/newdomain.com/fullchain.pem:/etc/nginx/ssl/newdomain.com/fullchain.pem:ro
    - /etc/letsencrypt/live/newdomain.com/privkey.pem:/etc/nginx/ssl/newdomain.com/privkey.pem:ro
    network_mode: host
    depends_on:
    - remnawave
    - remnawave-subscription-page
    logging:
    driver: 'json-file'
    options:
    max-size: '30m'
    max-file: '5'
  6. Open the nginx.conf file:

    Terminal window
    nano /opt/remnawave/nginx.conf
  7. Find the server block and replace olddomain.com with newdomain.com:

    nginx.conf
    server {
    server_name newdomain.com;
    listen 443 ssl;
    http2 on;
    ssl_certificate "/etc/nginx/ssl/newdomain.com/fullchain.pem";
    ssl_certificate_key "/etc/nginx/ssl/newdomain.com/privkey.pem";
    ssl_trusted_certificate "/etc/nginx/ssl/newdomain.com/fullchain.pem";
    add_header Set-Cookie $set_cookie_header;
    location / {
    if ($authorized = 0) {
    return 444;
    }
    proxy_http_version 1.1;
    proxy_pass http://remnawave;
    proxy_set_header Host $host;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Port $server_port;
    proxy_send_timeout 60s;
    proxy_read_timeout 60s;
    }
    }
  8. Restart the services to apply the changes:

    Terminal window
    cd /opt/remnawave && docker compose down && docker compose up -d

Generating a new SSL certificate

To use the new domain, you need to generate a new SSL certificate using the script

  1. Run the script:

    Terminal window
    remnawave_reverse
  2. Select option 8: Domain certificate management

  3. In the submenu select option 2: Generate new certificates for another domain

  4. Enter the new domain, for example, newdomain.com

  5. Select the method of obtaining the certificate: ACME or Cloudflare

  6. After successful execution, the certificates for the new domain will appear in the following directory:

    • Directory/etc/letsencrypt/ - root directory of certificates
      • Directorylive
        • Directorynewdomain.com - new domain
          • fullchain.pem
          • privkey.pem
        • Directoryolddomain.com - old domain
          • fullchain.pem
          • privkey.pem

Updating configuration files

After generating the certificate, update the domain in the Remnawave panel configuration files.

  1. Open the .env file for editing:

    Terminal window
    nano /opt/remnawave/.env
  2. Find the line with the current domain:

    .env
    FRONT_END_DOMAIN=olddomain.com
  3. Replace it with the new domain:

    .env
    FRONT_END_DOMAIN=newdomain.com
  4. Open the docker-compose.yml file:

    Terminal window
    nano /opt/remnawave/docker-compose.yml
  5. Find the remnawave-nginx service and update the paths to the certificates, replacing olddomain.com with newdomain.com:

    docker-compose.yml
    remnawave-nginx:
    image: nginx:1.28
    container_name: remnawave-nginx
    hostname: remnawave-nginx
    network_mode: host
    restart: always
    volumes:
    - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
    - /etc/letsencrypt/live/newdomain.com/fullchain.pem:/etc/nginx/ssl/newdomain.com/fullchain.pem:ro
    - /etc/letsencrypt/live/newdomain.com/privkey.pem:/etc/nginx/ssl/newdomain.com/privkey.pem:ro
    - /dev/shm:/dev/shm:rw
    - /var/www/html:/var/www/html:ro
    command: sh -c 'rm -f /dev/shm/nginx.sock && nginx -g "daemon off;"'
    depends_on:
    - remnawave
    - remnawave-subscription-page
    logging:
    driver: 'json-file'
    options:
    max-size: '30m'
    max-file: '5'
  6. Open the nginx.conf file:

    Terminal window
    nano /opt/remnawave/nginx.conf
  7. Find the server block and replace olddomain.com with newdomain.com:

    nginx.conf
    server {
    server_name newdomain.com;
    listen unix:/dev/shm/nginx.sock ssl proxy_protocol;
    http2 on;
    ssl_certificate "/etc/nginx/ssl/newdomain.com/fullchain.pem";
    ssl_certificate_key "/etc/nginx/ssl/newdomain.com/privkey.pem";
    ssl_trusted_certificate "/etc/nginx/ssl/newdomain.com/fullchain.pem";
    add_header Set-Cookie $set_cookie_header;
    location / {
    error_page 418 = @unauthorized;
    recursive_error_pages on;
    if ($authorized = 0) {
    return 418;
    }
    proxy_http_version 1.1;
    proxy_pass http://remnawave;
    proxy_set_header Host $host;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Port $server_port;
    proxy_send_timeout 60s;
    proxy_read_timeout 60s;
    }
    location @unauthorized {
    root /var/www/html;
    index index.html;
    }
    }
  8. Run the script remnawave_reverse

    Terminal window
    remnawave_reverse
  9. Select option 3: Panel/node management

  10. Select option 6: Access to the panel through port 8443 (only for panel + node)

  11. Go to the browser address that the script provided

  12. Enter the Remnawave panel and go to the Nodes —> Management section

  13. Select your node (Steal)

  14. Change the Address field to 172.30.0.1

    Address
  15. Click Save

  16. Go to the Hosts —> Your Host section

  17. In the Address field enter the new domain, for example newdomain.com

  18. Click Save

  19. Go to the Profiles —> Your profile (StealConfig) section

  20. Change “serverNames” to the new domain, for example newdomain.com

  21. Click Save

  22. Close access to port 8443 through the remnawave_reverse script

    Terminal window
    remnawave_reverse
  23. Restart the services:

    Terminal window
    cd /opt/remnawave && docker compose down && docker compose up -d
  1. Open the browser and go to the new domain (don’t forget about cookies):

    Terminal window
    https://newdomain.com/auth/login?MdAGAnCL=ExnqGvcX
  2. Make sure the Remnawave panel loads correctly and the SSL certificate works.

  3. If errors occur, check the logs:

    Terminal window
    cd /opt/remnawave && docker compose logs -f
  4. If the panel does not open, make sure that the DNS records for newdomain.com are updated and point to your server.