Skip to content
Jagoan Cloud Docs
  • Solutions
    • Server Ujian Online
    • Scalable WordPress
  • Products
    • Jagoan Cloud PaaS
      • Pricing
    • Cloud Backup
    • VPS Windows
    • Business Mail
    • SSL Certificate
  • Login App

Rapor Digital Madrasah

  • Cara Instalasi RDM

Panduan Dasar

  • Cara Memasang SSL di Jagoan Cloud
  • Mengubah domain Jagoan Cloud ke Domain Sendiri
  • Cara Menambahkan IP Public

Moodle

  • Cara Login ke Server Moodle di Jagoan Cloud
  • Cara Login ke Aplikasi Moodle di Jagoan Cloud
  • Cara Menggunakan Domain Pribadi untuk Aplikasi Moodle

Quick Start

  • Getting Started
  • Dashboard Guide
  • Welcome Tutorial
  • Software Stack Versions

Platform Overview

  • What is Platform-as-a-Service
  • Concept and Terminology
  • What are System Containers
  • What are Application Containers
  • Isolated Containers
  • What is Auto-Clustering
  • Cloudlet

Containers

  • Container Types
  • Container Image Requirements
  • Connect to Custom Container
  • Custom Container SSH Access
  • Private Registry Inside PaaS
  • Building Custom Containers

Environment Management

  • HTTP Headers
  • Clone Environment

Application Settings

  • Configuration File Manager
  • Managing Timezone Settings

Development Tools

  • FTP/FTPS Support

Account and Pricing

  • Account Registration
  • Account Types
  • Account Statuses
  • Account Password Reset
  • Quotas System
  • Two Factor Authentication
  • Personal Access Token
  • Upgrade and Refill Account
  • Pricing Model Overview

Architecture Overview

  • Cluster Overview
  • Cluster Orchestrator

Container Deployment

  • Certified Containers Deployment
  • Custom Containers Deployment
  • Docker Engine Deployment

Container Redeploy

  • Redeploy Overview
  • Preserve Data

Container Configuration

  • Configuration Tools
  • Container Environment Variables
  • Container Linking
  • Container Volumes
  • Container Ports
  • Container Run Configuration

Environment Variables

  • Java Options and Arguments
  • Default Environment Variables
  • Custom Environment Variables

Environment Groups

  • Overview
  • Group Creation
  • Navigation Between Groups
  • Group Management
  • Environment Isolations

Scaling and Clustering

  • Automatic Vertical Scaling
  • Horizontal Scaling
  • Automatic Horizontal Scaling
  • Data Synchronization
  • File Synchronization in Cluster
  • Auto-Clustering of Instances

Built-In Monitoring

  • Log Files
  • Statistics
  • Load Alerts

SSH

  • Generate SSH Key
  • Add SSH Key
  • SSH Access

Resource Charging

  • Pricing FAQ
  • Charged Resources
  • Monitoring Consumed Resource

Kubernetes

  • GitLab CI/CD Integration
  • Cluster Automated Upgrade
  • Public IP for Access to Kubernetes
  • Traefik v2 Ingress Controller

Kubernetes Cluster

  • Kubernetes Overview
  • System Requirements
  • Cluster Installation
  • Cluster Versions

Managing Kubernetes

  • Cluster Access
  • Access Controll
  • Cluster Troubleshooting
  • Cluster Upgrade
  • Velero Backup

Kubernetes Scalability

  • Vertical Scalling
  • Horizontal Scalling

Application Deployment

  • Helm Integration
  • YAML Deployments
  • Internal Networking
  • Exposing Services
  • Creating Ingresses

Persistent Data

  • Volume Provisioner
  • Persistent Volume Claim
  • Custom Storage

Domain Name Management

  • Swap Domain
  • Multiple Domain for PHP
  • Container DNS Hostnames

External Access to Applications

  • Shared Load Balancer
  • Public IP
  • Container Firewall
  • Endpoints

Traffic Distributor

  • Traffic Distributor Overview
  • Routing Methods
  • Traffic Distributor Installation
  • Traffic Distributor Integration
  • Use Case

SSL

  • Secure Socket Layer
  • Built-In SSL
  • Custom SSL
  • Custom SSL via SLB

Scheduling Configuration

  • Setting Up Cronjob
View Categories
  • Docs
  • Panduan Penggunaan Layanan & Platform Jagoan Cloud
  • Jagoan Cloud PaaS
  • Panduan Dasar
  • Application Settings
  • Domain Name Management
  • Multiple Domain for PHP

Multiple Domain for PHP

3 min read

Running Multiple Domain Names on PHP Server #

Dengan menggunakan multiple domain, Kamu bisa meningkatkan kemudahan penggunaan, efisiensi, dan skalabilitas aplikasi PHP-mu, serta tentunya menghemat biaya karena tidak perlu membuat instance terpisah untuk setiap domain.

Berikut langkah-langkah untuk menjalankan multiple domain pada server aplikasi PHP agar aplikasi kamu menjadi lebih scalable dan efektif :

1. Masuk ke dashboard Jagoan Cloud.

2. Klik tombol Create environment di pojok kiri atas dashboard.

3. Pada wizard yang muncul, buka tab PHP, pilih server aplikasi yang Lamu inginkan, dan tentukan jumlah resource yang dibutuhkan oleh aplikasi. Setelah itu, beri nama untuk environment-nya dan klik tombol Create.

Dalam beberapa saat, environment Kamu akan muncul di dashboard platform.

  1. Kamu perlu memiliki nama domain di DNS yang mengarah ke alamat IP milikmu. Untuk penjelasan lebih lanjut bisa Kamu baca di tutorial berikut : Custom Domain.
  2. Setelah itu, klik tombol Settings untuk environment-mu dan hubungkan domain-domain tersebut. Sebagai contoh, kita menggunakan URL: mydomain.com dan myseconddomain.com.

 


📝 NOTE
Dalam kasus ini, kita menambahkan entri pada file hosts untuk keperluan pengujian lokal, dan cara ini hanya akan berfungsi di mesin yang memiliki entri hosts tersebut.

 

6. Sekarang Kamu bisa mengunggah paket zip berisi aplikasimu ke Deployment Manager, lalu deploy ke environment yang sudah kamu buat sebelumnya.
upload first application

upload second application

7. Setelah aplikasimu berhasil di-deploy, Kamu perlu mengatur konfigurasi virtual host.

A. Untuk Apache:
Klik tombol Config di samping server Apache, lalu buka file httpd.conf (yang ada di direktori conf). Atur parameter VirtualHost secara terpisah untuk masing-masing domain dengan menentukan jalur ke konteks aplikasi yang sudah di-deploy serta nama domainnya, seperti ini:

Listen 80
<VirtualHost *:80>
    DocumentRoot /var/www/webroot/firstapp
    ServerName mydomain.com
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot /var/www/webroot/secondapp
    ServerName myseconddomain.com
</VirtualHost>

Apache httpd confB. Untuk NGINX:

1. Klik tombol Config di samping server NGINX, lalu buka file nginx.conf di direktori conf. Tentukan pengaturan kamu di dalam blok server:

  • server_name : Nama domain yang Kamu gunakan
  • root : Konteks atau jalur aplikasi yang Kamu tentukan saat proses deploy

Perlu dicatat bahwa setiap domain yang Kamu hubungkan harus memiliki blok server tersendiri dengan pengaturannya masing-masing. Contohnya:

server {
        listen       80;
        server_name  localhost;
include /etc/nginx/aliases.conf;
        location / {
            root   /var/www/webroot/ROOT;
            index  index.html index.htm index.php;
            location ~ \.php$ {
                location ~ /\. { deny all; access_log off; log_not_found off; }
            include /etc/nginx/fastcgi_params;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_param SCRIPT_FILENAME /var/www/webroot/ROOT$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_script_name;
            fastcgi_param DOCUMENT_ROOT /var/www/webroot/ROOT;
            }
        }
        index  index.php index.html index.htm;
error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
location ~ /\. { deny all; access_log off; log_not_found off; }
location ~ \.php$ {
        location ~ /\. { deny all; access_log off; log_not_found off; }
            include /etc/nginx/fastcgi_params;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_param SCRIPT_FILENAME /var/www/webroot$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_script_name;
            fastcgi_param DOCUMENT_ROOT /var/www/webroot;
        }
    }

Dalam tutorial ini, kita akan menggunakan config berikut :

  server {
        listen       80;
        server_name  mydomain.com;    
    include /etc/nginx/aliases.conf;
        location / {
            root   /var/www/webroot/firstapp;
            index  index.html index.htm index.php;
            location ~ \.php$ {
                location ~ /\. { deny all; access_log off; log_not_found off; }
            include /etc/nginx/fastcgi_params;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_param SCRIPT_FILENAME /var/www/webroot/firstapp$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_script_name;
            fastcgi_param DOCUMENT_ROOT /var/www/webroot/firstapp;
            }
        }
        index  index.php index.html index.htm;
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
            location ~ /\. { deny all; access_log off; log_not_found off; }   
        location ~ \.php$ {
        location ~ /\. { deny all; access_log off; log_not_found off; }
            include /etc/nginx/fastcgi_params;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_param SCRIPT_FILENAME /var/www/webroot$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_script_name;
            fastcgi_param DOCUMENT_ROOT /var/www/webroot;
        }
    }
server {
        listen       80;
        server_name  myseconddomain.com;
                include /etc/nginx/aliases.conf;
        location / {
            root   /var/www/webroot/secondapp;
            index  index.html index.htm index.php;
            location ~ \.php$ {
                location ~ /\. { deny all; access_log off; log_not_found off; }
            include /etc/nginx/fastcgi_params;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_param SCRIPT_FILENAME /var/www/webroot/secondapp$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_script_name;
            fastcgi_param DOCUMENT_ROOT /var/www/webroot/secondapp;
            }
        }
        index  index.php index.html index.htm;
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    location ~ /\. { deny all; access_log off; log_not_found off; }  
    location ~ \.php$ {
        location ~ /\. { deny all; access_log off; log_not_found off; }
            include /etc/nginx/fastcgi_params;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_param SCRIPT_FILENAME /var/www/webroot$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_script_name;
            fastcgi_param DOCUMENT_ROOT /var/www/webroot;
        }
    }

8. Jangan lupa untuk menyimpan perubahan dan me-restart server aplikasi agar pengaturan baru bisa diterapkan.

9. Sekarang Kamu bisa mengecek hasilnya untuk memastikan semuanya berjalan dengan baik.

PHP application in browser

Semoga instruksi ini bermanfaat untuk Kamu. Selamat mencoba!

What are your Feelings

Share This Article :

  • Facebook
  • X
  • LinkedIn
  • Pinterest
Still stuck? How can we help?

How can we help?

Updated on August 6, 2025

Powered by BetterDocs

Daftar Isi
  • Running Multiple Domain Names on PHP Server
© 2022 Jagoan Cloud