# Services Sites

In smoxy, users have the option to create sites and assign domains to these sites. These sites contain configurations that apply to all associated domains. A particularly useful feature in smoxy is the use of [Conditional Rules](https://docs.smoxy.eu/en/rules/conditional-rules). Using these rules, traffic routing based on the hostname can be performed to, for example, route requests to different servers. This guide recommends creating a central "Services" site that multiple domains can refer to. This provides an efficient way to manage services like RabbitMQ, Redis, Matomo, Rundeck, and others without the need to create a separate site for each domain.

## Benefits of the central "Services" Site&#x20;

Creating a central "Services" site in smoxy offers numerous advantages:

1. **Central Management:** With a single "Services" site, you can maintain a consolidated overview of all services used by different domains, significantly simplifying configuration and management.
2. **Reduced Configuration Effort:** Instead of creating a separate site for each domain, multiple domains can reference the same "Services" site, minimizing configuration effort and reducing the likelihood of errors.
3. **Efficient Scalability:** When adding additional domains or services, new Conditional Rules for the "Services" site need to be created, rather than creating new sites, making system scalability more straightforward.

## Using Conditional Rules in the "Services" Site&#x20;

To effectively utilize the "Services" site, Conditional Rules can be created to route requests to different load balancers or servers based on the hostname. Here's an exemplary approach:

1. **Service Configuration:** For each service centrally managed in the "Services" site, create a specific load balancer configuration. This includes information like the service's IP address and port.
2. **Create Conditional Rules:** Set up Conditional Rules for each domain that needs to access a service in the "Services" site. These rules consider the hostname (e.g., "rabbitmq.example.com" or "redis.example.com").
3. **Configure Routing:** In the Conditional Rules, specify that requests to this hostname should be routed to the appropriate load balancer.

## Example usage&#x20;

Suppose multiple domains need to access different services. Instead of creating a separate site for each domain, create a "Services" site and set up Conditional Rules for each domain. These rules route requests based on the domain's hostname to the respective load balancers.

<figure><img src="https://3000458937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNMHyPzupwEpnnrhQdgfe%2Fuploads%2FCap8xzdF05n5KZg9MHjX%2FCRServices.png?alt=media&#x26;token=e8f41eaf-8f48-4ccc-a76e-4149e89dfaba" alt=""><figcaption><p>Possible overview of conditional rules of a "Services" site</p></figcaption></figure>

<figure><img src="https://3000458937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNMHyPzupwEpnnrhQdgfe%2Fuploads%2F7ypfcnvryvVh7q5rb59c%2FCRLB.png?alt=media&#x26;token=566dc7b6-4693-4239-8f34-6f944d9a804e" alt=""><figcaption><p>Example configuration of a conditional rule for forwarding traffic depending on the host name</p></figcaption></figure>

The setup of a central "Services" site and the use of Conditional Rules are best practices in smoxy for efficient service management. This simplifies the configuration complexity.
