Yandex.Cloud
  • Services
  • Why Yandex.Cloud
  • Pricing
  • Documentation
  • Contact us
Get started
Use cases
  • Web service
    • All use cases
    • Static website in Object Storage
    • Website on LAMP or LEMP stack
    • Fault-tolerant website with load balancing from Yandex Network Load Balancer
    • Fault-tolerant website using DNS load balancing
    • Joomla-based website with PostgreSQL
    • WordPress website
    • WordPress website on a MySQL database
    • 1C-Bitrix website
  • Online stores
    • All use cases
    • 1C-Bitrix online store
    • Opencart online store
  • Data archive
    • All use cases
    • Single-node file server
    • Configuring an SFTP server on Centos 7
    • Backup to Object Storage via Acronis Backup
    • Backup to Object Storage via CloudBerry Desktop Backup
    • Backup to Object Storage via Duplicati
    • Backup to Object Storage via Bacula
    • Digitizing archives in Yandex Vision
  • Test environment
    • All use cases
    • Testing applications with GitLab
    • Creating test VMs using GitLab CI
    • High-performance computing on preemptible VMs
  • Infrastructure management
    • All use cases
    • Getting started with Terraform
    • Uploading Terraform states to Object Storage
    • Getting started with Packer
    • VM images building automation using Jenkins
    • Continuous deployment of containerized applications using GitLab
    • Creating a cluster of 1C:Enterprise Linux servers with a Managed Service for PostgreSQL cluster
    • Creating a cluster of 1C:Enterprise Windows servers with MS SQL Server
    • Migrating to Yandex.Cloud using Hystax Acura
    • Emergency recovery in Yandex.Cloud using Hystax Acura
    • Configuring a fault-tolerant architecture in Yandex.Cloud
  • Windows in Yandex.Cloud
    • All use cases
    • Deploying Active Directory
    • Deploying Microsoft Exchange
    • Deploying Remote Desktop Services
    • Deploying an Always On availability group
    • Deploying an Always On availability group with an internal network load balancer
  • Network routing
    • All use cases
    • Routing through a NAT instance
    • Creating a VPN tunnel
    • Installing a Cisco CSR1000v virtual router
    • Installing a Mikrotik CHR virtual router
    • Creating a VPN connection using OpenVPN
  • Data visualization and analytics
    • All use cases
    • Visualizing data from a CSV file
    • Visualizing data from a ClickHouse database
    • Visualizing data from Yandex.Metrica
    • Visualizing data from Yandex.Metrica Logs API
    • Publishing a chart with a map from a CSV file to DataLens Public
    • Visualizing data from AppMetrica
    • Visualizing geodata from a CSV file
  • Internet of things
    • Use cases for the internet of things
    • Status monitoring of geographically distributed devices
    • Monitoring sensor readings and event notifications
  1. Web service
  2. Joomla-based website with PostgreSQL

Joomla-based website with PostgreSQL

  • Before you start
    • Required paid resources
  • Create a VM for Joomla
  • Create a PostgreSQL database cluster
  • Install Joomla and additional components
  • Configure the Apache2 web server
  • Configure Joomla
  • Upload the website files
  • Configure the DNS
  • Check that the website is running
  • How to delete created resources

In these instructions, you'll learn how to deploy a website in Joomla CMS on a database running PostgreSQL in the Yandex.Cloud infrastructure.

To set up a static website on Joomla:

  1. Create a VM for Joomla.
  2. Create a PostgreSQL DB cluster.
  3. Install Joomla and additional components.
  4. Configure the Apache2 web server.
  5. Configure Joomla.
  6. Upload the website files.
  7. Configure DNS.
  8. Check that the website is running.

If you no longer need the website, delete all its resources.

Before you start

Before deploying the server, you need to sign up for Yandex.Cloud and create a billing account:

  1. Go to the management console. Then log in to Yandex.Cloud or sign up if don't already have an account.
  2. On the billing page, make sure you linked a billing account, and it has the ACTIVE or TRIAL_ACTIVE status. If you don't have a billing account, create one.

If you have an active billing account, you can create or select a folder to run your VM in from the Yandex.Cloud page.

Learn more about clouds and folders.

Make sure the selected folder has a network with subnets in the availability zones ru-cental1-a, ru-central1-b, and ru-central1-c. To do this, select Yandex Virtual Private Cloud on the folder page. If the list contains a network, click on its name to see the list of subnets. If the subnets or network you need are not listed, create them.

Required paid resources

The cost of hosting a website in Joomla includes:

  • A fee for a continuously running VM (see Yandex Compute Cloud pricing).
  • A fee for using a dynamic or static external IP address (see Yandex Virtual Private Cloud pricing).
  • A fee for the PostgreSQL database cluster (see pricing for Yandex Managed Service for PostgreSQL).
  • The cost of outgoing traffic from Yandex.Cloud to the internet (see Yandex Compute Cloud pricing).

Create a VM for Joomla

To create a VM:

  1. On the folder page in the management console, click Create resource and select Virtual machine.

  2. In the Name field, enter the VM name: joomla-pg-tutorial-web.

  3. Select the availability zone to host the VM in.

  4. Select the Ubuntu or CentOS public image.

  5. Under Computing resources:

    • Choose a platform.
    • Specify the necessary number of vCPUs and amount of RAM.

    The minimum configuration is enough for functional testing:

    • Platform: Intel Cascade Lake.
    • Guaranteed vCPU share: 5%.
    • vCPU: 2.
    • RAM: 1 GB.
  6. In the Network settings section, select the subnet to connect the VM to when creating it.

  7. Specify data required for accessing the VM:

    • Enter the username in the Login field.
    • In the SSH key field, paste the contents of the public key file.
      You need to create a key pair for an SSH connection yourself. To generate keys, use third-party tools, such as ssh-keygen utilities on Linux and macOS or PuTTygen on Windows.
  8. Click Create VM.

Creating the VM may take several minutes.

When a VM is created, it is assigned an IP address and hostname (FQDN). This data can be used for SSH access.

Create a PostgreSQL database cluster

  1. On the folder page, click Create resource and select PostgreSQL cluster.
  2. In the Name field, enter the cluster name: joomla-pg-tutorial-db-cluster.
  3. In the DB class section, select b2.medium.
  4. In the Storage size section, enter 10 GB.
  5. In the Database section:
    1. In the DB name field, enter joomla-pg-tutorial-db.
    2. In the Username field, enter joomla.
    3. In the Password field, enter the password you will use to access the DB.
  6. In the Network list, select the network your VM is connected to.
  7. In the Hosts section, add two more hosts in the other availability zones. When creating hosts, do not enable Public access to them.
  8. Click Create cluster.

Creating the DB cluster may take several minutes.

Install Joomla and additional components

After the joomla-pg-tutorial-web VM's status changes to RUNNING, do the following:

  1. You can learn the IP address of the VM under Network on the VM page in the management console.

  2. Connect to the VM over SSH. You can use the ssh tool in Linux and macOS or PuTTY for Windows.

    The recommended authentication method when connecting over SSH is using a key pair. Don't forget to set up the created key pair: the private key must match the public key sent to the VM.

  3. Download and unpack the Joomla archive:

    $ sudo mkdir -p /var/www/html/
    $ curl https://downloads.joomla.org/cms/joomla3/3-8-7/Joomla_3-8-7-Stable-Full_Package.tar.gz?format=gz -o Joomla_3-8-7-Stable-Full_Package.tar.gz -L
    $ sudo mv Joomla_3-8-7-Stable-Full_Package.tar.gz /var/www/html/
    $ (cd /var/www/html/ && sudo tar -zxvf Joomla_3-8-7-Stable-Full_Package.tar.gz)
    $ sudo rm /var/www/html/Joomla_3-8-7-Stable-Full_Package.tar.gz
    $ sudo mv /var/www/html/htaccess.txt /var/www/html/.htaccess
    
  4. Install additional components:

    Ubuntu 14
    Ubuntu 16
    Ubuntu 18
    CentOS 6
    CentOS 7
    $ echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
    $ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
    $ sudo apt-get update
    $ sudo apt-get -q -y install php5-pgsql php5-curl php5-json php5-cgi php5 libapache2-mod-php5 php5-mcrypt apache2 php5-common cron debconf-utils sendmail unzip iptables postgresql-client-10
    $ sudo mkdir ~www-data/.postgresql
    $ sudo wget "https://crls.yandex.net/allCLCAs.pem" -O ~www-data/.postgresql/root.crt
    $ sudo chmod 0600 ~www-data/.postgresql/root.crt
    $ sudo chown -R www-data:www-data ~www-data/.postgresql
    
    $ echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
    $ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
    $ sudo apt-get update
    $ sudo apt-get -q -y install php7.0-pgsql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7.0 php7.0-mcrypt apache2 php-mail php7.0-common cron debconf-utils sendmail unzip iptables composer postgresql-client-10
    $ sudo mkdir ~www-data/.postgresql
    $ sudo wget "https://crls.yandex.net/allCLCAs.pem" -O ~www-data/.postgresql/root.crt
    $ sudo chmod 0600 ~www-data/.postgresql/root.crt
    $ sudo chown -R www-data:www-data ~www-data/.postgresql
    
    $ echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
    $ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
    $ sudo apt-get update
    $ sudo apt-get -q -y install php7.2-pgsql php7.2-curl php7.2-json php7.2-cgi php7.2 libapache2-mod-php7.2 apache2 php-mail php7.2-common cron debconf-utils sendmail unzip iptables composer postgresql-client-10
    $ sudo mkdir ~www-data/.postgresql
    $ sudo wget "https://crls.yandex.net/allCLCAs.pem" -O ~www-data/.postgresql/root.crt
    $ sudo chmod 0600 ~www-data/.postgresql/root.crt
    $ sudo chown -R www-data:www-data ~www-data/.postgresql
    
    $ sudo yum -y install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-6-x86_64/pgdg-centos10-10-2.noarch.rpm
    $ sudo yum -y install http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
    $ sudo yum check-update
    $ sudo yum -y install --enablerepo remi-php72 httpd php php-pgsql php php-common php-mbstring php-zip php-xml nano wget postgresql10
    $ sudo mkdir ~apache/.postgresql
    $ sudo wget "https://crls.yandex.net/allCLCAs.pem" -O ~apache/.postgresql/root.crt
    $ sudo chmod 0600 ~apache/.postgresql/root.crt
    $ sudo chown -R apache:apache ~apache/.postgresql
    
    $ sudo yum -y install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
    $ sudo yum -y install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
    $ sudo yum check-update
    $ sudo yum -y install --enablerepo remi-php72 httpd php php-pgsql php php-common php-mbstring php-zip php-xml nano wget postgresql10
    $ sudo mkdir ~apache/.postgresql
    $ sudo wget "https://crls.yandex.net/allCLCAs.pem" -O ~apache/.postgresql/root.crt
    $ sudo chmod 0600 ~apache/.postgresql/root.crt
    $ sudo chown -R apache:apache ~apache/.postgresql
    

Configure the Apache2 web server

  1. Perform the basic configuration of Apache2:

    Ubuntu 14
    Ubuntu 16
    Ubuntu 18
    CentOS
    $ sudo a2enmod php5
    $ sudo a2dismod mpm_event
    $ sudo a2enmod mpm_prefork
    $ sudo a2enmod rewrite
    $ sudo chown -R www-data /var/www/html/
    
    $ sudo a2enmod php7.0
    $ sudo a2dismod mpm_event
    $ sudo a2enmod mpm_prefork
    $ sudo a2enmod rewrite
    $ sudo chown -R www-data /var/www/html/
    
    $ sudo a2enmod php7.2
    $ sudo a2dismod mpm_event
    $ sudo a2enmod mpm_prefork
    $ sudo a2enmod rewrite
    $ sudo chown -R www-data /var/www/html/
    
    $ sudo chown -R apache /var/www/html/
    
  2. Specify the virtual host settings in the Apache2 configuration file. You can edit the file in the nano editor:

    Ubuntu
    CentOS
    $ sudo nano /etc/apache2/sites-enabled/000-default.conf
    
    $ sudo nano /etc/httpd/conf.d/joomla.conf
    

    Make the file look like:

    <VirtualHost *:80 [::]:80>
            ServerAdmin webmaster@localhost
            DocumentRoot /var/www/html/
    
            <Directory /var/www/html/>
                    DirectoryIndex index.php index.html
                    DirectorySlash off
                    RewriteEngine on
                    RewriteBase /
                    AllowOverride all
            </Directory>
    </VirtualHost>
    
  3. Restart the web server:

    Ubuntu
    CentOS
    $ sudo service apache2 restart
    
    $ sudo service httpd restart
    
  4. This step should only be performed on a VM running CentOS.

    Change the SELinux settings:

    $ sudo semanage fcontext -a -t httpd_sys_content_t "/var/www/html(/.*)?"
    $ sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html(/.*)?"
    $ sudo restorecon -R /var/www/html
    $ setsebool -P httpd_can_network_connect 1
    
  5. This step should only be performed on a VM running CentOS 6.

    Open network ports 80 and 443 using the iptables utility:

    $ sudo iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
    $ sudo iptables -I INPUT -p tcp -m tcp --dport 443 -j ACCEPT
    $ sudo iptables-save | sudo tee /etc/sysconfig/iptables
    

Configure Joomla

Configure Joomla following the instructions on the project website.
During the configuration process, you'll need the DB connection settings. To get the parameters and configure them correctly, do the following:

  1. Get the addresses of the DB cluster hosts in the management console:

    1. Open the folder where the DB cluster was created.
    2. Select Managed Service for PostgreSQL.
    3. Select the cluster joomla-pg-tutorial-db-cluster.
    4. Open the Hosts tab.
    5. In the Address (domain name) column, find the host addresses.
  2. At the Database step, fill in the following fields in the Joomla web installer:

    • DB type: PostgreSQL.

    • DB server name:

      <address of host 1>,<address of host 2>,<address of host 3> port=6432 sslmode=verify-full target_session_attrs=read-write
      
    • Username:joomla.

    • Password: enter the DB user's password.

    • DB name: joomla-pg-tutorial-db.

For security reasons, Joomla may ask you to delete a special test file. On the VM, go to the /var/www/html/installation directory and delete the specified file from it.

Upload the website files

  1. You can learn the IP address of the VM under Network on the VM page in the management console.

  2. Connect to the VM over SSH.

  3. Grant your user write access to the directory /var/www/html:

    Ubuntu
    CentOS
    $ sudo chown -R "$USER":www-data /var/www/html
    
    $ sudo chown -R "$USER":apache /var/www/html
    
  4. Upload the website files to the VM over SCP:

    Linux/macOS
    Windows

    Use the scp command-line utility:

    $ scp -r <path to the file directory> <VM user name>@<VM IP address>:/var/www/html
    

    Use the WinSCP program to copy the local file directory to the /var/www/html directory on the VM.

Configure the DNS

The domain name that you want to use for your website must be associated with the created joomla-pg-tutorial-web VM.

The instructions below describe how to configure an external DNS service using reg.ru for the www.example.com and example.com domain names:

  • An A record allows you to map the example.com domain name to its IP address.
  • A CNAME (Canonical Name) record for www allows you to access your website via www.example.ru.

To configure the external DNS service, do the following:

  1. You can learn the IP address of the VM under Network on the VM page in the management console.
  2. Log in to the control panel of the external DNS service. Go to the list of your domains and click on the required domain name.
  3. Follow the Zone management link in the Domain management section.
  4. Create or edit an A record:
    • IP Address: your VM's public IP address.
    • Subdomain: @ (points to the main domain).
  5. Create a CNAME record with the following field values:
    • Subdomain: www.
    • Canonical name: @ or the example.com. domain with a dot at the end.
  6. Wait 15-20 minutes for DNS record changes to take effect. The waiting time may differ for your DNS service.

Check that the website is running

To test the website, open it in the browser at: http://<VM public IP address>.

You can check the domain name the same way only 15-20 minutes after editing the DNS records.

How to delete created resources

To stop paying for your deployed server and DB, just delete the created VM joomla-pg-tutorial-web and cluster Managed Service for PostgreSQL joomla-pg-tutorial-db-cluster.

If you reserved a static public IP address specifically for this VM:

  1. Open the Virtual Private Cloud in your folder.
  2. Go to the IP addresses tab.
  3. Find the address you need, click , and select Delete.
In this article:
  • Before you start
  • Required paid resources
  • Create a VM for Joomla
  • Create a PostgreSQL database cluster
  • Install Joomla and additional components
  • Configure the Apache2 web server
  • Configure Joomla
  • Upload the website files
  • Configure the DNS
  • Check that the website is running
  • How to delete created resources
Language
Careers
Privacy policy
Terms of use
© 2021 Yandex.Cloud LLC