Languages
[Edit]
EN

apache2 - add virtual server that uses subdomain with PHP and Cloudflare DNS

10 points
Created by:
Kate_C
20320

In this article we would like to show how to add subdomain as virtual server for apache2 that uses PHP engine with Cloudflare DNS / CDN.

Preseted article configures Open Web Analitics that:

  • was installed in own separated folder,
  • will be available from:┬áhttps://owa.my-domain.com.

Simple steps:

It is necessary to configure apache2 server at first and later Cloudflare DNS.

1. apache2 server configuration

1.1. login as root to yours server,

1.2. create new configuration file in sites-avaialble directory with command:

nano /etc/apache2/sites-available/open-web-analytics.conf

1.3. put inside following configuration:

<VirtualHost *:80>

  ServerName      owa.my-domain.com
  DocumentRoot    /var/www/html/open-web-analytics
  DirectoryIndex  index.php

</VirtualHost>

Where:

  • owa.my-domain.com - subdomain used with┬áOpen Web Analitics,
  • /var/www/html/open-web-analytics - directory path with installed Open Web Analitics,
  • index.php - script that runs Open Web Analitics.

1.4. enable open-web-analytics site

Use following command:

a2ensite open-web-analytics.conf

Output:

Enabling site open-web-analytics.
To activate the new configuration, you need to run:
  systemctl reload apache2

1.5. Reload apache2 configuration witout restarting

Run following command:

systemctl reload apache2

2. Cloudflare DNS configuration

2.1. login to Cloudflare panel: https://dash.cloudflare.com/login

2.2. select your domain on main page - will be visible after login operation

domain selection panel - Cloudflare
domain selection panel - Cloudflare

2.3. go to DNS configuration

DNS configuration option - Cloudflare
DNS configuration option - Cloudflare

2.4. add new DNS record by clicking to: + Add record

2.5. select following configuration:

Type:            A
Name:            owa
IPv4 address:    77.55.222.88

Where: owa and 77.55.222.88 can be replaced by own configuration.

It will give us traffic from https://owa.my-domain.com to server located on 77.55.222.88 where virtual server described by ServerName owa.my-domain.com will be used.

subdomain DNS configuration - Cloudflare
subdomain DNS configuration - Cloudflare

2.6. save configuration and check if new record appeared

subdomain DNS record - Cloudflare
subdomain DNS record - Cloudflare

3. Check Open Web Analitics in Web Browser

3.1. go to following address: https://owa.my-domain.com,

3.2. as result you should see:

Open Web Analitics run with apache2 virtual server, subdomain and on Cloudflare
Open Web Analitics run with apache2 virtual server, subdomain and on Cloudflare
Native Advertising
­čÜÇ
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - friendly IT community for everyone.

ÔŁĄ´ŞĆ­čĺ╗ ­čÖé

Join