50% off 全プラン、期間限定。料金は $2.48/mo
Initial Documents

Host multiple websites on vps

By Parnian R. 6 min read Updated Feb 15, 2026

Navigating the complexities of web hosting can often lead to the
サーバーリソースの過小利用。特に複数の
ウェブサイトを管理する場合に該当します。本記事では、以下の方法を示すことでこの課題に対応しています。
単一のサーバーで複数のウェブサイトをホストしています。
capabilities of Apache on Linux systems (Ubuntu and CentOS) and Internet
Information Services (IIS) on Windows, users can maximize their server’s
potential, streamline website management, and significantly reduce
オーバーヘッドコストを削減できます。本ガイドはサーバー管理者に
ホスティング環境を最適化するためのステップバイステップの手順を提供しています。
ensuring each website operates seamlessly under a consolidated server
setup.

Apache
Configuration for Ubuntu and CentOS

This section guides you through the process of configuring Apache to
単一のサーバーで複数のウェブサイトをホストします。特に
Ubuntu and CentOS systems.

Prerequisites

Update your system’s package database:

Ubuntu/Debian:

sudo apt update
sudo apt upgrade -y

CentOS/RHEL:

sudo yum update -y

Ensure you have sudo privileges to perform
administrative tasks.

Step 1: Install
Apache

Ubuntu/Debian:

sudo apt install apache2 -y

CentOS/RHEL (The package is named httpd):

sudo yum install httpd -y

Step 2: Create
Directories

各ウェブサイト用のルートディレクトリを作成します。

sudo mkdir -p /var/www/domain.com/public_html
sudo mkdir -p /var/www/domain2.com/public_html

Replace domain.com and domain2.com with
your actual domain names.

Create Directories

Step 3: Assign
Permissions

Set the permissions to allow the web server to access the
content:

sudo chown -R $USER:$USER /var/www/domain.com/public_html
sudo chown -R $USER:$USER /var/www/domain2.com/public_html
sudo chmod -R 755 /var/www
Assign Permissions

Step 4: Create Index
Pages

Create a simple index.html file for each domain:

echo "Welcome to domain.com" | sudo tee /var/www/domain.com/public_html/index.html
echo "Welcome to domain2.com" | sudo tee /var/www/domain2.com/public_html/index.html

Step 5: Configure
Virtual Hosts

デフォルト設定ファイルをコピーし、各ドメイン用に編集します。

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/domain.com.conf
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/domain2.com.conf

Edit the virtual host file for domain.com:

sudo nano /etc/apache2/sites-available/domain.com.conf

Inside the file, make the necessary changes:

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName domain.com
    ServerAlias www.domain.com
    DocumentRoot /var/www/domain.com/public_html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Configure Virtual Hosts

Repeat the process for domain2.com.

Step 6: Enable Sites

新しいサイトを有効にし、デフォルトサイトを無効にします。

sudo a2ensite domain.com.conf
sudo a2ensite domain2.com.conf
sudo a2dissite 000-default.conf
Enable Sites

Step 7: Restart
Apache

Apache を再起動して変更を適用します。

Ubuntu/Debian:

sudo systemctl restart apache2

CentOS/RHEL:

sudo systemctl restart httpd

Step 8: Edit
Hosts File and Test Websites

Edit Hosts File:

  • hosts ファイルをテキストエディタで開きます。
sudo nano /etc/hosts
  • サーバーのIPアドレスを指す、ドメイン用のエントリを追加します。
    for example:
192.168.1.10 domain.com
192.168.1.10 domain2.com
Edit Hosts File
  • ファイルを保存して閉じます。

Alternatively Update DNS A Records:

登録済みのドメインがある場合は、DNS で A レコードを更新してください
サーバーの IP アドレスを指すように設定してください。

Test Websites with Curl:

ウェブサイトがアクセス可能な状態か確認してください。

curl http://domain.com
curl http://domain2.com
Test Websites with Curl

IIS Configuration
for Windows Server

This section provides a comprehensive walkthrough for setting up
multiple websites on a single server using Internet Information Services
(IIS) on Windows Server.

Step
1: Install IIS using Add Roles and Features Wizard

  1. Open Server Manager: Click on the Server Manager
    タスクバーのアイコンをクリックするか、スタートメニューから開きます。

  2. Launch Add Roles and Features Wizard: In the
    Server Manager dashboard, click on Manage and then
    select Add Roles and Features.

  3. Role-Based or Feature-Based Installation: Choose
    Role-based or feature-based installation and click on
    Next.

Select Installation Type
  1. Select Server: Choose the server on which you
    want to install IIS and click on Next.

  2. Add Roles: ロールセクションでチェックボックスをオンにしてください
    for Web Server (IIS)。機能追加を求められた際に
    はWeb Server (IIS)に必要です。こちらをクリックしてください Add
    Features
    .

Select Server Roles
  1. Features: No additional features are required
    特別な要件がない限り。クリック Next.
Select Features
  1. Web Server Role (IIS): Review the information
    and click on Next.

  2. Role Services: Select the IIS role services to
    インストールします。基本的なウェブサーバーの場合、デフォルト設定で問題ありません。
    sufficient. Click on Next.

Select Role Services
  1. Confirmation: Review your selections and click
    on Install. The installation process will
    begin.

  2. Completion: インストールが完了したら、
    click on Close.

Step 2: Add Websites

  1. Open IIS Manager: Press Windows key +
    R
    , type inetmgr, and press
    Enter.
Open IIS Manager
  1. Create a New Website: 右クリックしてください
    Sites folder in the IIS Manager and select Add
    Website
    .

  2. Website Details:

  • Site name: Enter a descriptive name.

  • Physical path: Select the folder containing your
    website’s files.

  • Type: Usually http.

  • IP address: Select an IP or leave as All
    Unassigned
    .

  • Port: Typically 80 for
    HTTP.

  • Host name: Enter the domain name.

Add Website
  1. Repeat for Additional Websites: Follow the same
    steps for each website.

Step 3: Configure Host
Headers

  1. Select a Website: Click on the website in IIS
    Manager.

  2. Open Bindings: In the Actions
    panel, click on Bindings.

Open Bindings
  1. Edit or Add Binding: In Site
    Bindings
    、既存のバインディングを編集するか、
    Add.

  2. Specify Host Name: Enter the hostname in the
    Host name field.

Specify Host Name
  1. Repeat for Additional Websites: Follow the same
    steps for each website.

Step 4: Manage
DNS and Edit Hosts File

  1. Update DNS Records: For your domain names to be
    IIS サーバーに解決されるため、DNS の A レコードを次のアドレスにポイントするよう更新してください
    サーバーのパブリックIPアドレス。以下を使用している場合に必要です
    registered domain names.

  2. Edit the Hosts File (Optional): If you don’t
    ドメインを持っていてローカルでテストしたい場合は、以下のホストファイルを編集できます
    ローカルマシン上に保存されます(サーバーではなく)。このファイルは通常、以下の場所にあります
    **C:*** 各ウェブサイトのエントリを追加して、IPアドレスを指定します
    IIS サーバーの。例:

192.168.1.10 domain.com
192.168.1.10 domain2.com

Replace 192.168.1.10 with the IP address of your
Windows Server。変更はこのウェブサイトのみに適用されます
ホストファイルを編集するマシンからアクセスできます。

Edit the Hosts File

Step 5: Verify
Websites

Open a web browser and navigate to each domain to ensure that the
ウェブサイトが正しく配信されています。hostsファイルを編集した場合は、
編集したマシンでこれを実行してください。コンテンツが表示されるはずです。
すべてが正しく設定されている場合、ウェブサイトが正常に機能します。

Test in Browser

Step 6:
Additional Configurations (Optional)

  1. SSL Certificates: HTTPS を使用する予定の場合、
    you’ll need to install and configure SSL certificates for each
    site.

  2. Application Pools: Consider creating separate
    application pools for each website for better management and
    security.

  3. Security Settings: Review and configure security
    settings as per your requirements.

Each website will be accessible via its own domain name, sharing the
same server resources.

結論として、単一のサーバーで複数のウェブサイトをホストする場合
Apache または IIS は効率的でコスト効果に優れています。詳細な手順に従うことで
Ubuntu、CentOS、Windows サーバーの手順に従うことで、
ウェブ管理を簡潔にし、サーバーリソースを最適化して
オンラインでの確かな存在感を持つことができます。ご不明な点がございましたら、いつでもお気軽にお問い合わせください
us by submitting
a ticket
.

Share

Need help with something else?

Median response time under 1 hour. Real humans, not bots.