Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Administrator

Pages: [1] 2 3 ... 6
1
WebHosting-Billing / WebHosting-Billing by CWP
« on: May 08, 2023, 05:36:25 AM »
WebHosting-Billing is a free open-source billing and client management solution for CWP based on BoxBilling.
Please note that this is not a public version, it's only for developers and testing as it has some vulnerabilities.

GitHub: https://github.com/cwpdev/webhosting-billing

You can participate and work on the improvements of it.

2
High Performance / CWP WebServers Detailed INFO
« on: December 16, 2018, 01:29:14 AM »
CWP WebServers Config (CWP version 0.9.8.741+)
Now with CWP servers, you have the highest flexibility that you could ever imagine.
You can run different WebServers Setup for each domain and even combine other servers and have many other possibilities.

To have the ability of all options first you need to install and enable all webservers that you would need.
We recommend going with all: Nginx/Varnish/Apache as then you have all other options.

1. Install required WebServers
In CWP.admin left menu go to WebServer Settings -> Select WebServers

Apache Only
With apache only, you get all these options available per domain/subdomain.
- 10.1 Apache + php-cgi (suPHP handler running PHP Selector & PHP Switcher, it can also change PHP version per folder).
- 10.2 Apache + php-fpm (via PHP-FPM Selector, one php version per domain/subdomain).
- 10.3 Apache + proxy (proxy to custom port, example for tomcat or to other IP and port).

Nginx Only
With nginx only, you have this two options available per domain/subdomain.
Please note that Nginx with PHP-FPM requires custom templates for each type of cms as it handles rewrite rules in the vhost configuration.
- 20.2 Nginx + php-fpm (via PHP-FPM Selector, one php version per domain/subdomain).
- 20.3 Nginx + proxy (proxy to custom port, example for tomcat or to other IP and port).

LiteSpeed
This is the same setup like "Apache Only" with php-cgi/suPHP handler.

Nginx & Apache
This option allows you to run the best from both worlds of Nginx & Apache.
Since Nginx is if front of Apache it will also handle many static files and reduce the load on apache so apache can handle more traffic.
- 10.1.1 Nginx/Apache + php-cgi (suPHP handler running PHP Selector & PHP Switcher, it can also change PHP version per folder).
- 10.2.1 Nginx/Apache + php-fpm (via PHP-FPM Selector, one php version per domain/subdomain).
- 10.3.1 Nginx/Apache + proxy (proxy to custom port, example for tomcat or to other IP and port).
- 20.2 Nginx + php-fpm (via PHP-FPM Selector, one php version per domain/subdomain).
- 20.3 Nginx + proxy (proxy to custom port, example for tomcat or to other IP and port).

Nginx & Varnish
This option is recommended only if you need to use Nginx & Varnish as proxy and cache servers for your other server or a custom application running on a custom port.
- 20.2 Nginx + php-fpm (via PHP-FPM Selector, one php version per domain/subdomain).
- 20.3 Nginx + proxy (proxy to custom port, example for tomcat or to other IP and port).
- 30.1 Nginx/Varnish -> proxy to custom IP:port, example for tomcat/ruby/nodejs or some other server

Nginx & Varnish & Apache (recommended)
The best option you could ever imagine giving you the full flexibility and the best performances.
- 10.1.1 Nginx/Apache + php-cgi (suPHP handler running PHP Selector & PHP Switcher, it can also change PHP version per folder).
- 10.2.1 Nginx/Apache + php-fpm (via PHP-FPM Selector, one php version per domain/subdomain).
- 10.3.1 Nginx/Apache + proxy (proxy to custom port, example for tomcat or to other IP and port).
- 10.1.2 Nginx/Varnish/Apache + php-cgi (suPHP handler running PHP Selector & PHP Switcher, it can also change PHP version per folder).
- 10.2.2 Nginx/Varnish/Apache + php-fpm (via PHP-FPM Selector, one php version per domain/subdomain).
- 10.3.2 Nginx/Varnish/Apache + proxy (proxy to custom port, example for tomcat or to other IP and port).
- 20.2 Nginx + php-fpm (via PHP-FPM Selector, one php version per domain/subdomain).
- 20.3 Nginx + proxy (proxy to custom port, example for tomcat or to other IP and port).
- 30.1 Nginx/Varnish -> proxy to custom IP:port, example for tomcat/ruby/nodejs or some other server.


All options explained
- 10.1 Apache + php-cgi (suPHP handler running PHP Selector & PHP Switcher, it can also change PHP version per folder)
   This is our old the most flexible apache which supports any script and also has the advantage of php selector and php-switcher.
   * php selector - gives you the flexibility to run a different php version per folder by using htaccess.
   * php switcher - this is a default version of php installed during cwp first setup and its also default for all new accounts/domains/subdomains.

- 10.2 Apache + php-fpm (via PHP-FPM Selector, one php version per domain/subdomain)
   This is our new feature which provides you with the maximum performances which php has to offer. It runs via fcgi handler with php-fpm selector.
   Here you can run different php versions only per domain/subdomain.


- 10.3 Apache + proxy (proxy to custom port, example for tomcat or to other IP and port)
   Apache proxy works like a proxy for other applications or other location, example you can proxy some domain/subdomain to other IP:PORT.
   This can be useful if you need to run some other application on the custom port or if you need to proxy to your custom application on the other server.

- 10.1.1 Nginx/Apache + php-cgi (suPHP handler running PHP Selector & PHP Switcher, it can also change PHP version per folder)
   This is our old the most flexible apache which supports any script and also has the advantage of php selector and php-switcher.
   Nginx is here used as a proxy server so it will handle ssl and also will handle many static files to reduce the load on apache giving you the better performances.
   * php selector - gives you the flexibility to run a different php version per folder by using htaccess.
   * php switcher - this is a default version of php installed during cwp first setup and its also default for all new accounts/domains/subdomains.

- 10.2.1 Nginx/Apache + php-fpm (via PHP-FPM Selector, one php version per domain/subdomain)
   This is our new feature which provides you with the maximum performances which php has to offer. It runs via fcgi handler with php-fpm selector.
   Here you can run different php versions only per domain/subdomain via php-fpm selector.
   Nginx is here used as a proxy server so it will handle ssl and also will handle many static files to reduce the load on apache giving you the better performances.

- 10.3.1 Nginx/Apache + proxy (proxy to custom port, example for tomcat or to other IP and port)
   Apache proxy works like a proxy for other applications or other location, example you can proxy some domain/subdomain to other IP:PORT.
   This can be useful if you need to run some other application on the custom port or if you need to proxy to your custom application on the other server.
   You can also run nginx proxy directly to avoid apache but in some cases, you need to do it via apache.

- 10.1.2 Nginx/Varnish/Apache + php-cgi (suPHP handler running PHP Selector & PHP Switcher, it can also change PHP version per folder)
   This is our old the most flexible apache which supports any script and also has the advantage of php selector and php-switcher.
   Nginx is here used as a proxy server so it will handle ssl and also will handle many static files to reduce the load on apache giving you the better performances.
   Varnish will make your php scripts look like a static site and provide incredible performance and dramatically reduce the load of php-cgi.
   * php selector - gives you the flexibility to run a different php version per folder by using htaccess.
   * php switcher - this is a default version of php installed during cwp first setup and its also default for all new accounts/domains/subdomains.

- 10.2.2 Nginx/Varnish/Apache + php-fpm (via PHP-FPM Selector, one php version per domain/subdomain)
   This is our new feature which provides you with the maximum performances which php has to offer. It runs via fcgi handler with php-fpm selector.
   Here you can run different php versions only per domain/subdomain via php-fpm selector.
   Nginx is here used as a proxy server so it will handle ssl and also will handle many static files to reduce the load on apache giving you the better performances.
   Varnish will make your php scripts look like a static site and provide incredible performance and reduce the load of php-fpm.

- 10.3.2 Nginx/Varnish/Apache + proxy (proxy to custom port, example for tomcat or to other IP and port)
   Nginx is here used as a proxy server so it will handle ssl and also will handle many static files to reduce the load on apache giving you the better performances.
   Varnish will make your scripts look like a static site and provide incredible performance and reduce the load on your script.
   Apache proxy works like a proxy for other applications or other location, example you can proxy some domain/subdomain to other IP:PORT.

- 20.2 Nginx + php-fpm (via PHP-FPM Selector, one php version per domain/subdomain)
   This is our new feature which provides you with the maximum performances which php has to offer. It runs via fcgi handler with php-fpm selector.
   Please note that when nginx is handling all then you need to make custom templates for each type of cms depending on the rewrite/redirect rules you need.

- 20.3 Nginx + proxy (proxy to custom port, example for tomcat or to other IP and port)
   Nginx is here used as a proxy server so it will handle ssl and also will handle many static files to reduce the number of request to your application.

- 30.1 Nginx/Varnish -> proxy to custom IP:port, example for tomcat/ruby/nodejs or some other server
   Nginx is here used as a proxy server so it will handle ssl and also will handle many static files to reduce the number of request to your application.
   Varnish will make your scripts look like static site and provide incredible performance and reduce the load on your script.


Force PHP-FPM
This option would disable php-cgi so you wouldn't be able to use it anymore.
You will be only able to use PHP-FPM selector, PHP Switcher and PHP Selector will not be in use anymore

Activation of varnish
By default Varnish is always disabled, you can only activate it in CWP.admin left menu go to WebServer Settings -> WebServers Domain Conf when you selecting varnish in the custom config for that domain.

Why is Varnish by default disabled?
It's disabled because it cache's almost anything and for example when you modify your site from admin it would still show the old content until the cache expires.

When do I need to activate varnish?
We recommend activation of varnish only when you need to reduce the load because of high number of php processes.


Please also check this instructions:
- WebServers vHost Templates
- Wordpress High Performances

3
High Performance / Wordpress - High-Performance instructions
« on: December 02, 2018, 02:18:13 PM »
Wordpress - High-Performance instructions
Currently, this is available only for CentOS 7 version 0.9.8.741+, soon will be available also for CentOS 6.

Video Instructions
https://www.youtube.com/watch?v=5PeACKK4Mq4

- make sure you have installed php-fpm 7.0, 7.1 or 7.2...you can choose any version.
- rebuild your webservers with Nginx & Varnish & Apache.

Now we will explain here two types of websites, one is webshop or website with order forms and frequent changes and the other is a company website that doesn't make updates frequently but has a high traffic.

1. webshop (or website with frequent changes).
2. company website (which has no frequent changes but has a high traffic).

1. webshop (or website with frequent changes)
* for this kind of website we recommend that the varnish is disabled or has a custom config, please note that by default varnish is always disabled so you will not need to do anything specific here as varnish needs to be additionally enabled even if you run webservers with setup Nginx & Varnish & Apache.

- default php-fpm configuration for version 7.0, 7.1 or 7.2 will be ok.
- nginx should be enabled and if you have built servers as Nginx & Varnish & Apache then you are ok.
- Make sure that in left menu WebServers Settings -> WebServers Domain Conf config for your domain for apache is set to nginx -> apache -> php-fpm and PHP-FPM version is set to 7.0, 7.1 or 7.2.
- if you run WordPress you should install in WordPress cache plugin like "W3 Total Cache".
and you are ready to go, with this kind of setup your site will be able to handle up to 15x more traffic with much higher speed.


2. company website (which has no frequent changes but has a high traffic)
* for this kind of website we recommend that varnish is enabled, please note that by default varnish is always disabled so you will need to additionally enabled it even if you run webservers with setup Nginx & Varnish & Apache.

- default php-fpm configuration for version 7.0, 7.1 or 7.2 will be ok.
- nginx&varnish should be enabled and if you have built servers as Nginx & Varnish & Apache then you are ok.
- Make sure that in left menu WebServers Settings -> WebServers Domain Conf config for your domain for apache is set to nginx -> varnish -> apache -> php-fpm and PHP-FPM version is set to 7.0, 7.1 or 7.2. This will activate Varnish and php-fpm.
- if you run WordPress you should install in WordPress cache plugin like "W3 Total Cache".
and you are ready to go, with this kind of setup your site will be able to handle up to 30x more traffic with much higher speed.

YouTube instructions:
https://www.youtube.com/watch?v=5PeACKK4Mq4

** Please note that php 7 is recommended here as it's much faster than php 5.

--
More detailed info about new cwp webservers
http://forum.centos-webpanel.com/high-performance/cwp-webservers-detailed-info/

Custom Templates
http://wiki.centos-webpanel.com/webservers-vhost-templates

4
MySQL / Instructions for fixing roundcube issues
« on: May 17, 2017, 08:13:17 PM »
If you get this error message on your roundcube link:
Code: [Select]
DATABASE ERROR: CONNECTION FAILED!
Unable to connect to the database!
Please contact your server-administrator.

Check roundcube logs in file: /usr/local/cwpsrv/var/services/roundcube/logs/errors

In case that your error looks like this
Code: [Select]
[17-May-2017 20:18:11 +0000]: <gv4343g> DB Error: SQLSTATE[HY000] [1045] Access denied for user 'roundcube'@'localhost' (using password: YES) in /usr/local/cwpsrv/var/services/roundcube/program/lib/Roundcube/rcube_db.php on line 173 (GET /roundcube/)
[17-May-2017 20:18:11 +0000]: <gv4343g> DB Error: SQLSTATE[HY000] [1045] Access denied for user 'roundcube'@'localhost' (using password: YES) (GET /roundcube/)

Check the password set in roundcube config in file /usr/local/cwpsrv/var/services/roundcube/config/config.inc.php
Code: [Select]
grep db_dsnw /usr/local/cwpsrv/var/services/roundcube/config/config.inc.php
Output will be like this
Code: [Select]
$config['db_dsnw'] = 'mysqli://roundcube:42Etn3fd7skc@localhost/roundcube';** This means that your password is 42Etn3fd7skc

Now lets set the same in mysql.
Code: [Select]
mysql -e "SET PASSWORD FOR 'roundcube'@'localhost' = PASSWORD('42Etn3fd7skc');"
mysql -e "FLUSH PRIVILEGES;"

Now again check if roundcube works.

In case you get this error:
Code: [Select]
[17-May-2017 20:29:09 +0000]: <gv91fd30g> DB Error: [1146] Table 'roundcube.session' doesn't exist (SQL Query: SELECT `vars`, `ip`, `changed`, now() AS ts FROM `session` WHERE `sess_id` = 'gv93bfdsfdffdfdj3') in /usr/local/cwpsrv/var/services/roundcube/program/lib/Roundcube/rcube_db.php on line 539 (GET /roundcube/)

run this command
Code: [Select]
mysql -u root 'roundcube' < /usr/local/cwpsrv/var/services/roundcube/SQL/mysql.initial.sqlthat is it, enjoy your roundcube.

5
CentOS 6 Problems / CentOS6 Upgrade
« on: March 14, 2017, 08:24:48 PM »
THIS ARE UPGRADE INSTRUCTIONS ONLY FOR CWP VERSION 0.9.8.1xx or lower

This is now critical issue as old version 0.9.8.1xx will completely expire soon and some of the important server services like backups and monitoring will stop working!

Procedure
===============
- Make sure that you are running CWP version 0.9.8.15x before proceedMySQL!!!
- Check your mysql version, you need to have mysql version 5.5 or higher (command: mysql --version)
- If your MySQL version is 5.1 or less than 5.5 then you need to upgrade MySQL by using MySQL upgrade script (instructions are bellow)
- Switch your server to Apache only mode in WebServers menu (you need to disable nginx and varnish, instructions are bellow )
- Download and Run CWP upgrade script (instructions are bellow)
- Download and Run Apache Upgrade script (instructions are bellow)

MySQL Upgrade (NOT required if you have MariaDB or MySQL 5.5 or newer)
- Before running any mysql upgrade please make sure you have backups of your databases, if you have cwp backups enabled then you should also have backups, but please check before proceeding.
Code: [Select]
cd /usr/local/src
wget http://dl1.centos-webpanel.com/files/el6/cwpupgrade/mysql.sh
sh mysql.sh

CWP Upgrade script
- Download and Run CWP upgrade script
Code: [Select]
cd /usr/local/src
wget http://dl1.centos-webpanel.com/files/el6/cwpupgrade/cwpsrv.sh
sh cwpsrv.sh

Apache Upgrade script
- Before running apache upgrade script, login into cwp.admin and check that you are running apache only under Apache Settings --> Select WebServers, don't forget to rebuild vhosts also.
- Download and Run Apache upgrade script
Code: [Select]
cd /usr/local/src
wget http://dl1.centos-webpanel.com/files/el6/cwpupgrade/apache.sh
sh apache.sh

If something goes wrong with you apache try also this command
Code: [Select]
yum reinstall cwp-httpd cwp-suphp

RESTORE
If something goes wrong you can restore your apache/cwpsrv with the command
Code: [Select]
cd /usr/local/src
sh cwpsrv.sh restore
sh apache.sh restore

*** Please note that it would be good that you have some system admin at your side before proceeding :)
If you stuck somewhere you can restore your current version and/or contact our support for assistance.
http://centos-webpanel.com/contact

6
Information / Developers needed
« on: January 31, 2017, 11:16:10 PM »
We need developers and system admins for work on the new development and upgrade of the existing cwp parts.
We are also ready to pay for all your suggestions and solutions you can do to make cwp better.

Needed
- php, javascript developers
- linux system admins

Task
- Improvement of existing php modules of cwp
- Improvement of installer and bash scripts
- improvement of the existing design
- Adding new things and scripts into cwp
...many others

Your assistance will help us to be even better and we are ready to pay you for your assistance.

For any info contact us from the following link
http://centos-webpanel.com/contact

7
Suggestions / CWP Plugin Store
« on: October 17, 2015, 10:29:10 PM »
CWP Plugin Store
=====================
To attract more developers we are preparing CWP Plugin Store.

Developers will have opportunity to sell their plugins and ideas to the CWP users all over the world.
We suggest to developers to have lower prices on the plugins so they could attract more buyers.

All code will be will be checked and secured by the main and trusted developers.

If you want to become CWP developer and earn, join us!

Wiki, How to build CWP Modules (with PHP, its easy)
http://wiki.centos-webpanel.com/how-to-build-a-cwp-module

CWP Store Coming Soon!

For more info or assistance you can contact us
http://centos-webpanel.com/contact

8
Migration from other control panels / Migration from Webuzo panel
« on: February 05, 2015, 07:27:47 AM »
Migration of the account from Webuzo is pretty simple.

1. Create a New account in your CWP.admin (its suggested to use database prefix as a username)
2. Unpack Webuzo backup file in the public_html folder of new created account
3. In CWP make database and user (for wordpress check wp-config.php file and use the same)
4. now using phpMyAdmin you can import database, this is file named softsql.sql

That would be it.

From command line as root you can import database using the following command
Code: [Select]
mysql DATABASE_NAME < FILE_NAME.sql

Migration Using Softaculous PREMIUM
Restore through softaculous(premium) backup restore functionality works for migration from webuzo to CWP.
1. need account username to be the same same
2. need softaculous premium version.
3. move backup files to home/USERNAME/softaculous_backups
4. create addon domains
5. restore backup through softaculous restore functionality

9
FTP / FTP connection FAILED
« on: January 13, 2015, 10:51:15 PM »
CWP is main goal is to be a self healing control panel and if you have an issue with FTP connection CWP will try to autoFix it.

How to autofix your FTP server issue?
- Login to CWP.admin as root
- go to left Menu --> File Management --> FTP Management
...and that is it.

Simple, if you had any issue once you opened FTP Management your issue should be resolved.
CWP will autocheck for few well known issues and display you a message about what issue is fixed.

If you still have the same issue then you should contact support.

10
PHP / PHP Selector
« on: January 11, 2015, 05:03:05 AM »
From version 0.9.8 all CWP servers have a CWP PHP Selector which can install all PHP versions with a single click.
Using CWP PHP selector you can use a different PHP version per folder or domain.

Available PHP versions in the CWP PHP Selector
- php 4.4
- php 5.2
- php 5.3
- php 5.4
- php 5.5
- php 5.6
- php 7.0
- php 7.1
- php 7.2
- php 7.x (development version from php git, don't use for production server!!!)

You can completely modify flags per PHP version according to you needs.

PHP per folder
Now each user can run PHP version per folder, meaning that each folder can have a different php version, example:
/home/USERNAME/public_html  runs PHP 5.4
/home/USERNAME/public_html/test  runs PHP 5.6
/home/USERNAME/public_html/my-domain.com  runs PHP 5.2
/home/USERNAME/public_html/my-domain.com/application runs PHP 5.3


Usage instructions
In each folder you want to run different PHP version you only need to define it in the .htaccess file.

Example for file: /home/USERNAME/public_html/.htaccess

Use PHP 4.4
Code: [Select]
AddHandler application/x-httpd-php44 .php
Use PHP 5.2
Code: [Select]
AddHandler application/x-httpd-php52 .php
Use PHP 5.3
Code: [Select]
AddHandler application/x-httpd-php53 .php
Use PHP 5.4
Code: [Select]
AddHandler application/x-httpd-php54 .php
Use PHP 5.5
Code: [Select]
AddHandler application/x-httpd-php55 .php
Use PHP 5.6
Code: [Select]
AddHandler application/x-httpd-php56 .php
Use PHP 7.0
Code: [Select]
AddHandler application/x-httpd-php70 .php
Use PHP 7.1
Code: [Select]
AddHandler application/x-httpd-php71 .php
Use PHP 7.2
Code: [Select]
AddHandler application/x-httpd-php72 .php

To run some other PHP version in the other folder, you can use the same example.

Example lets run php 5.3 in /home/USERNAME/public_html/domain1.com/
Edit /home/USERNAME/public_html/domain1.com/.htaccess file and add
Code: [Select]
AddHandler application/x-httpd-php53 .php
Example lets run php 5.2 in /home/USERNAME/public_html/domain2.com/
Edit /home/USERNAME/public_html/domain2.com/.htaccess file and add
Code: [Select]
AddHandler application/x-httpd-php52 .php

php.ini configuration file locations
Code: [Select]
/opt/alt/php44/usr/php/php.ini
/opt/alt/php52/usr/php/php.ini
/opt/alt/php53/usr/php/php.ini
/opt/alt/php54/usr/php/php.ini
/opt/alt/php55/usr/php/php.ini
/opt/alt/php56/usr/php/php.ini
/opt/alt/php70/usr/php/php.ini
/opt/alt/php71/usr/php/php.ini
/opt/alt/php72/usr/php/php.ini

php config file scan dir
Code: [Select]
/opt/alt/php44/usr/php/php.d
/opt/alt/php52/usr/php/php.d
/opt/alt/php53/usr/php/php.d
/opt/alt/php54/usr/php/php.d
/opt/alt/php55/usr/php/php.d
/opt/alt/php56/usr/php/php.d
/opt/alt/php70/usr/php/php.d
/opt/alt/php71/usr/php/php.d
/opt/alt/php72/usr/php/php.d

and so on.

To delete some php selector version use this command (example)
rm -Rf /opt/alt/php71

be careful with this command as you can easily delete wrong path.

11
DNS / Bind DNS Record examples
« on: January 10, 2015, 03:05:12 AM »
In this examples we will use TTL 14400 , this means that you records will be rechecked in 14400 seconds for changes.


Address Records
The most commonly used type of record. This record maps an IP Address to a hostname.
Code: [Select]
www      IN    A      1.2.3.4
This can be used to point subdomain to some other server IP like:
Code: [Select]
my-subdomain      IN    A      2.2.3.5
This is also used for pointg your nameservers to IP address, for example:
Code: [Select]
ns1 14400 IN A 1.2.3.4
ns2 14400 IN A 1.2.4.5

Alias
Used to create an alias from an existing A record. You can create a CNAME record pointing to another CNAME record. But it doubles the number of requests made to the nameserver, thus making it an inefficient way to do so.
Code: [Select]
mail     IN    CNAME  www
www      IN    A      1.2.3.4

SRV Record example
The theory behind SRV is that given a known domain name e.g. example.com, a given service e.g. web (http) which runs on tcp in this case, a DNS query may be issued to find the host name that provides such on behalf of the domain - and which may or may not be within the domain.
Code: [Select]
_service._protocolName  IN SRV priority weight portNO subdns.domain.com
_ldap._tcp.example.com.    SRV 0 0 389 ldap.example.net.
_ldap._tcp.dc._msdcs.example.com. SRV 0 0 389 dc1.example.com.


DNS Records Explained with Examples

DNS (Domain Name System), is the service which translates between Internet names and Internet addresses.
Internet names are the names which we use to refer to hosts on the Internet, such as www.debianhelp.co.uk.
Internet addresses are the numbers which routers use to move traffic across the Internet, such as 211.1.13.115 and

What are DNS Records ?

DNS records or Zone files are used for mapping URLs to an IPs. Located on servers called the DNS servers, these records are typically the connection of your website with the outside world. Requests for your website are forwarded to your DNS servers and then get pointed to the WebServers that serve the website or to Email servers that handle the incoming email.

Different Types of DNS Records With Syntax and Examples

Types of DNS Records

A
AAAA
CNAME
MX
PTR
NS
SOA
SRV
TXT
NAPTR

The above DNS records are mostly used in all DNS Configurations. Now we will see each one with examples.

A Record

An A record or address record.

Address Record, assigns an IP address to a domain or subdomain name. When the domain name system was designed it was recommended that no two A records refer to the same IP address.

Suppose you have the somedomain.tld domain and want to assign 10.10.0.1 IP address to your web server, then you should create an A record with "www.somedomain.tld" as Fully Qualified Domain Name and "10.10.0.1" in the value field.

From now on, all the requests for www.somedomain.tld will be sent to a server with that IP.

Basically is useful to use an A record when you have subdomains residing on various systems.

Usefultip: you might use a "*.somedomain.tld" A record to allow WHATEVER.somedomain.tld to be resolved to your IP, though a wildcard CNAME record is often better than a wildcard A record.

Example of A Record with Syntax

example.com. IN A 69.9.64.11

Where

IN indicates Internet

A indicates the Address record.

The above example indicate that the IP Address for the domain example.com is 69.9.64.11

AAAA Record

An AAAA record or IPv6 address record maps a hostname to a 128-bit IPv6 address.

The regular DNS Address resource record is defined for a 32-bit IPv4 address, so a new one was created to allow a domain name to be associated with a 128-bit IPv6 address. The four “A”s (“AAAA”) are a mnemonic to indicate that the IPv6 address is four times the size of the IPv4 address. The AAAA record is structured in very much the same way as the A record in both binary and master file formats; it is just much larger. The DNS resource record Type value for AAAA is 28.

Example of AAAA Record with Syntax


The AAAA record is to help transition and coexistence between IPv4 and IPv6 networks.An IPv4 nameserver can provide IPv6 addresses:

linux aaaa 3ffe:1900:4545:2:02d0:09ff:fef7:6d2c

CNAME Record

A CNAME record or canonical name record makes one domain name an alias of another. The aliased domain gets all the subdomains and DNS records of the original.

You should use a CNAME record whenever you want associate a new subdomain to an already existing A record; i.e. you can make "www.somedomain.tld" to "somedomain.tld", which should already have been assigned an IP with an A record.

This allows you to have as many subdomains as you wish without having to specify the IP for every record. Use a CNAME if you have more services pointing to the same IP. This way you will have to update only one record in the convenience of a change of IP address.

Example of a CNAME record: "stuff.everybox.com CNAME www.everybox.com" where 'www.everybox.com' is an A record listing an IP address, and 'stuff.everybox.com' points to 'www.everybox.com'. It will NOT allow you to foward a domain to a specific web page. Use a webhop for that. Port numbers can be changed with webhops, as well; CNAMEs cannot change the HTTP default of 80 to any other port number.

Do not use CNAME defined hostnames in MX records. For example, this is not recommended

Example Of CNAME With syntax

mail.example.com IN CNAME mail.example.net

where

IN indicates Internet

CNAME indicates CNAME record.

MX Record

An MX record or mail exchange record maps a domain name to a list of mail exchange servers for that domain.

Example with MX Record Syntax - Single mail servers

mydomain.com. 14400 IN MX 0 mydomain.com.

The MX record shows that all emails @ mydomain.com should be routed to the mail server at mydomain.com. The DNS record shows that mydomain.com is located at 26.34.9.14. This means that email meant for test@mydomain.com will be routed to the email server at 26.34.9.14. This finishes the task of the MX record. The email server on that server then takes over, collects the email and then proceeds to distribute it to the user ``test''.

It is important that there be a dot(``.'') after the domain name in the MX record. If the dot is absent, it routes to ``mydomain.com.mydomain.com''. The number 0, indicates Preferance number. Mail is always routed to the server which has the lowest Preferance number. If there is only one mail server, it is safe to mark it 0.

Using Multiple mail servers

If you want to use multiple mail servers you have to use MX record preferences.The MX record preference values indicate which mail server to use and in which order to try them when they fail or don't respond. A larger preference number is less preferred. Thus, a mail exchanger with a preference of zero (0) is always preferred over all other mail exchangers. Setting preference values to equal numbers makes mail servers equally preferred.

Example with MX Record Syntax - Multiple mail servers

mydomain.com. 14400 IN MX 0 mydomain.com.
mydomain.com. 14400 IN MX 30 server2.mydomain.com

You can have unlimited MX entries for Fallback or backup purpose.If all the MX records are equal Preference numbers, the client simply attempts all equal Preference servers in random order, and then goes to MX record with the next highest Preference number.

PTR Record

A PTR record or pointer record maps an IPv4 address to the canonical name for that host. Setting up a PTR record for a hostname in the in-addr.arpa domain that corresponds to an IP address implements reverse DNS lookup for that address. For example www.name.net has the IP address 122.0.3.16, but a PTR record maps 16.3.0.122.in-addr.arpa.

Example of PTR Record with syntax

16.3.0.122.in-addr.arpa. IN PTR name.net

Here as you see the IP Address is reversed and added with in-addr.arpa and this has come to the left side while the actual domain name has gone to right side of IN PTR.

This is mostly used as a security and an anti-spam measure wherein most of the webservers or the email servers do a reverse DNS lookup to check if the host is actually coming from where it claims to come from. It is always advisable to have a proper reverse DNS record (PTR) is been setup for your servers especially when you are running a mail / smtp server.

NS Record

An NS record or name server record maps a domain name to a list of DNS servers authoritative for that domain. Delegations depend on NS records.

NS Record Name Server Record which indicates the Authoritative Name Servers for a particular Domain. The NS records of the Authoritative Name Server for any given Domain will be listed on the Parent Server. These are called as the Delegation Records as these records on the Parent Server indicates the delegation of the domain to the Authoritative servers.

The NS record will also be listed in the Zone records of the Authoritative Name Server itself. These records are called as the Authoritative Records.

The NS records found on the Parent Server should match the NS records on the Authoritative Server as well. However, you can have NS records listed on the Authoritative server that is not listed in the Parent Server. This arrangement is normally used to configure Stealth Name Servers.

Example of NS Record With syntax

example.com. IN NS ns1.live.secure.com.

where

IN indicates the Internet

NS indicates the type of record which Name Server record

The above indicates that the ns1.live.secure.com is the authoritative server for the domain example.com

SOA Record

An SOA record or start of authority record specifies the DNS server providing authoritative information about an Internet domain, the email of the domain administrator, the domain serial number, and several timers relating to refreshing the zone.

An SOA(State of Authority) Record is the most essential part of a Zone file. The SOA record is a way for the Domain Administrator to give out simple information about the domain like, how often it is updated, when it was last updated, when to check back for more info, what is the admins email address and so on. A Zone file can contain only one SOA Record.

A properly optimized and updated SOA record can reduce bandwidth between nameservers, increase the speed of website access and ensure the site is alive even when the primary DNS server is down.

Example of SOA Record with syntax

Here is the SOA record. Notice the starting bracket ``(``. This has to be on the same line, otherwise the record gets broken.

; name TTL class rr Nameserver email-address
mydomain.com. 14400 IN SOA ns.mynameserver.com. root.ns.mynameserver.com. (
2004123001 ; Serial number
86000 ; Refresh rate in seconds
7200 ; Update Retry in seconds
3600000 ; Expiry in seconds
600 ; minimum in seconds )

name - mydomain.com is the main name in this zone.

TTL - 14400 - TTL defines the duration in seconds that the record may be cached by client side programs. If it is set as 0, it indicates that the record should not be cached. The range is defined to be between 0 to 2147483647 (close to 68 years !) .

Class - IN - The class shows the type of record. IN equates to Internet. Other options are all historic. So as long as your DNS is on the Internet or Intranet, you must use IN.

Nameserver - ns.nameserver.com. - The nameserver is the server which holds the zone files. It can be either an external server in which case, the entire domain name must be specified followed by a dot. In case it is defined in this zone file, then it can be written as ``ns'' .

Email address - root.ns.nameserver.com. - This is the email of the domain name administrator. Now, this is really confusing, because people expect an @ to be in an email address. However in this case, email is sent to root@ns.nameserver.com, but written as root.ns.nameserver.com . And yes, remember to put the dot behind the domain name.

Serial number - 2004123001 - This is a sort of a revision numbering system to show the changes made to the DNS Zone. This number has to increment , whenever any change is made to the Zone file. The standard convention is to use the date of update YYYYMMDDnn, where nn is a revision number in case more than one updates are done in a day. So if the first update done today would be 2005301200 and second update would be 2005301201.

Refresh - 86000 - This is time(in seconds) when the slave DNS server will refresh from the master. This value represents how often a secondary will poll the primary server to see if the serial number for the zone has increased (so it knows to request a new copy of the data for the zone). It can be written as ``23h88M'' indicating 23 hours and 88 minutes. If you have a regular Internet server, you can keep it between 6 to 24 hours.

Retry - 7200 - Now assume that a slave tried to contact the master server and failed to contact it because it was down. The Retry value (time in seconds) will tell it when to get back. This value is not very important and can be a fraction of the refresh value.

Expiry - 3600000 - This is the time (in seconds) that a slave server will keep a cached zone file as valid, if it can't contact the primary server. If this value were set to say 2 weeks ( in seconds), what it means is that a slave would still be able to give out domain information from its cached zone file for 2 weeks, without anyone knowing the difference. The recommended value is between 2 to 4 weeks.

Minimum - 600 - This is the default time(in seconds) that the slave servers should cache the Zone file. This is the most important time field in the SOA Record. If your DNS information keeps changing, keep it down to a day or less. Otherwise if your DNS record doesn't change regularly, step it up between 1 to 5 days. The benefit of keeping this value high, is that your website speeds increase drastically as a result of reduced lookups. Caching servers around the globe would cache your records and this improves site performance.

SRV Record

The theory behind SRV is that given a known domain name e.g. example.com, a given service e.g. web (http) which runs on tcp in this case, a DNS query may be issued to find the host name that provides such on behalf of the domain - and which may or may not be within the domain.

Example of SRV Record with syntax

srvce.prot.name ttl class rr pri weight port target
_http._tcp.example.com. IN SRV 0 5 80 www.example.com.

srvce

Defines the symbolic service name (see IANA port-numbers) prepended with a '_' (underscore). Case insensitive. Common values are:

_http - web service
_ftp - file transfer service
_ldap - LDAP service

prot

Defines the protocol name (see IANA service-names) prepended with a '_' (underscore). Case insensitive. Common values are

_tcp - TCP protocol
_udp - UDP protocol

name

Incomprehensible description in RFC 2782. Leaving the entry blank (without a dot) will substitute the current zone root (the $ORIGIN), or you can explicitly add it as in the above _http._tcp.example.com. (with a dot).

ttl

Standard TTL parameter. For more information about TTL values.

pri

The relative Priority of this service (range 0 - 65535). Lowest is highest priority.

weight

Used when more than one service with same priority. A 16 bit unsigned integer in the range 0 - 65535. The value 0 indicates no weighting should be applied. If the weight is 1 or greater it is a relative number in which the highest is most frequently delivered i.e. given two SRV records both with Priority = 0, one with weight = 1 the other weight = 6, the one with weight 6 will have its RR delivered first 6 times out of 7 by the name server.

port

Normally the port number assigned to the symbolic service but does this is not a requirement e.g. it is permissible to define a _http service with a port number of 8100 rather than the more normal port 80.

target

The name of the host that will provide this service. Does not have to be in the same zone (domain).

TXT Record

A TXT record allows an administrator to insert arbitrary text into a DNS record. For example, this record is used to implement the Sender Policy Framework specification.

Example of TXT Record with syntax


SPF domains have to publish at least two directives: a version identifier and a default mechanism.

mydomain.com. TXT "v=spf1 -all"

This is the simplest possible SPF record: it means your domain mydomain.com never sends mail.

It makes sense to do this when a domain is only used for web services and doesn't do email.

MX servers send mail, designate them.

mydomain.com. TXT "v=spf1 mx -all"

Let's pretend mydomain.com has two MX servers, mx01 and mx02. They would both be allowed to send mail from mydomain.com.

other machines in the domain also send mail, designate them.

mydomain.com. TXT "v=spf1 mx ptr -all"

This designates all the hosts whose PTR hostname match mydomain.com.

any other machines not in the domain also send mail from that domain, designate them.

mydomain.com. TXT "v=spf1 a:mydomain.com mx ptr -all"

mydomain.com's IP address doesn't show up in its list of MX servers. So we add an "a" mechanism to the directive set to match it.

mydomain.com. TXT "v=spf1 a mx ptr -all"

This is shorthand for the same thing.

Each of your mail servers should have an SPF record also.When your mail servers create a bounce message, they will send it using a blank envelope sender: <>. When an SPF MTA sees a blank envelope sender, it will perform the lookup using the HELO domain name instead. These records take care of that scenario.

amx.mail.net. TXT "v=spf1 a -all"
mx.mail.net. TXT "v=spf1 a -all"

NAPTR Record

NAPTR records (NAPTR stands for "Naming Authority Pointer") are a newer type of DNS record that support regular expression based rewriting.

Example of NAPTR Record with syntax

$ORIGIN 3.8.0.0.6.9.2.3.6.1.4.4.e164.arpa.

NAPTR 10 100 "u" "E2U+sip" "!^.*$!sip:info@example.com!" .
NAPTR 10 101 "u" "E2U+h323" "!^.*$!h323:info@example.com!" .
NAPTR 10 102 "u" "E2U+msg" "!^.*$!mailto:info@example.com!" .

This record set maps the phone number +441632960083 onto three possible identically ordered URIs, with a preference for SIP, then H323, and finally email. In each case, the regular expression matches the full AUS (^.$), and replaces it with a URI (e.g., sip:info@example.com). As this is a terminal record, this URI is returned to the client.Though most NAPTR records replace the full AUS, it is possible for the regular expression to back-reference part of the AUS, to grab an extension number, say:

$ORIGIN 0.6.9.2.3.6.1.4.4.e164.arpa. *

NAPTR 10 100 "u" "E2U+sip""!^+441632960(.*)$!sip:\1@example.com!" .

Once the client has the URI it must be resolved using DNS, but this is no longer part of the DDDS algorithm..

wildcard DNS record

A wildcard DNS record is a record in a DNS zone file that will match all requests for non-existent domain names, i.e. domain names for which there are no records at all.













12
Apache / How to setup Website on the IP address
« on: December 27, 2014, 01:06:07 PM »
You can also setup website on the IP address but this is not recommended since here are important server applications like (webmail, FTP, phpMyAdmin...)

Instructions
- Upload files to folder: /usr/local/apache/htdocs/
- Change permissions on all files to user nobody using the following command
Code: [Select]
chown -R nobody.nobody /usr/local/apache/htdocs/
If you need to use a database, you can create it using CWP.admin --> MySQL Manager or phpMyAdmin.




13
CSF Firewall / DDoS Protection script
« on: December 07, 2014, 01:13:37 AM »
Popular DDoS Deflate script with tiny modification to use CSF Firewall for IP blocking.
By default once installed, script will block all IP's having more than 250 connections.

Configuration
- File for ignored IPs "/usr/local/ddos/ignore.ip.list"
- Configuration File "/usr/local/ddos/ddos.conf"

INSTALL
Code: [Select]
cd /usr/local/src
rm -f /usr/local/src/install.sh
wget http://dl1.centos-webpanel.com/files/security/ddos-deflate/install.sh
chmod 0700 install.sh
./install.sh

IP's will be blocked with the comment "DDoS Deflate".



14
How to / Change Hostname (FQHN - FQDN)
« on: November 22, 2014, 12:33:35 AM »
Its Required to have a valid Fully Qualified Domain Name or FQDN for the hostname to be used on the inernet.

In this example we will use myserver.domain.com and server IP address 199.199.199.199 , but you will need to replace it with your registered and working domain and your public server IP address!

Few Examples of server hostname (domain needs to be replaced with your domain name):e
server1.domain.com
neptun.domain.com
srv1.domain.com



How to Change Server Hostname on CentOS Server



1.

Open the /etc/sysconfig/network file with your favorite text editor.
Modify the HOSTNAME= value to match your FQDN host name.

Example:
Code: [Select]
nano /etc/sysconfig/network
Code: [Select]
HOSTNAME=myserver.domain.com

2.
Change the host that is associated to your main IPaddress for your server, this is for internal networking (found at /etc/hosts file)

BEFORE
# cat /etc/hosts
127.0.0.1  localhost.localdomain localhost

AFTER (add main server ip and hostname)
# cat /etc/hosts
127.0.0.1  localhost.localdomain localhost
199.199.199.199 myserver.domain.com myserver

3.
From command line
Code: [Select]
hostname
hostname myserver.domain.com

15
Migration from other control panels / Migrate account from cPanel server
« on: November 09, 2014, 06:50:01 PM »
If you need to migrate account from the cpanel server, you can do that very fast from the control panel.

Steeps
1. Upload cpmove/backup file in the /home folder
2. Goto Left Menu --> User Accounts --> cPanel Migration
3. enter username of the account which you want to restore (cpmove-USERNAME.tar.gz file must be in the /home folder)
4. select cpmove-USERNAME.tar.gz file to restore
5. enter domain, contact email and start restoring account
6. restore should be now done, if not successful the check bellow for the error solutions.

Known issues
1. cPanel backup file name must be named cpmove-USERNAME.tar.gz
2. Unpacked folder name must be cpmove-USERNAME

cPanel Migration Wizard restores the following
- All Files from public_html folder
- All MySQL databases
- All Users for the MySQL databases

Pages: [1] 2 3 ... 6