---
title: "Update server's primary virtual host"
method: GET
path: "/set_primary_servername"
tags: ["Server Administration", "System Information"]
---

# Update server's primary virtual host

`GET /set_primary_servername`

This function sets the primary domain hosted on an IP address and web server port. The primary domain refers to the virtual host that the server returns when a visitor directly accesses the IP address.

For example, if both `example1.com` and `example2.com` are name-based virtual hosts on IP address `192.168.0.1`, the primary virtual host appears when the visitor accesses the `http://192.168.0.1/` location.

**Important:**

When you disable the [Web Server role](https://go.cpanel.net/serverroles#roles), the system **disables** this function.

## Query parameters

- `servername` string, domain, required
- `type` 'std' | 'ssl'

## Response `200`

HTTP Request was successful.

- object
  - `metadata` object
    - `command` string — The method name called.
    - `reason` string — The reason the API function failed when the `metadata.result` field is `0`. This field may display a success message when a function succeeds.
    - `result` 0 | 1 — * `1` — Success. * `0` — Failed. Check the `reason` field for more details.
    - `version` integer — The version of the API function.

---

[API](https://skmtc.net/cpanel/apis/whm-api.md) · [All operations](https://skmtc.net/cpanel/apis/whm-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/cpanel/whm-api/revisions/3da41671c02c/schema)
