Locally Host Your Apache Web Server

Setup Web Server in Your Office

Create your own local web server to hosting website & emails

    Hosting your own Dedicated Web Server Machine

    Host Web Server Locally

    Why would someone at first place not hire a reputed company for hosting and setup their own web and email server in their office. Reasons can include, not storing email and website data on third party servers for security reasons, or for setting up a locally hosted dev environment or for a local email server within your commercial setup, or to save costs if your are a big organization and local deployment works safer and cheaper. The use-cases are endless, but this is not something for anyone and if you are not sure, we recommend opting for a hosting from a reputed service provider.

    Having your own dedicated server sounds a little too complex but if we say that it is possible, then there should be something to it. Many people with little to no knowledge of hosting stuff are advised to not move ahead with this and get a technical person involved. Though it is very simple and straightforward to setup web server in Offices and commercial locations, it may not be for everyone. Also, hosting your own server may come with issues such as support and error resolving. Lets skip all the talking and come straight to the point of things that you would need to host your own web server.

    Requirements of hosting your own server machine:

    • A little knowledge of installing Operating System, basic linux commands, knowledge of IP addresses, subnets etc and knowledge of Apache / PHP/ MySQL
    • A computer (preferably a server type) but any Intel or AMD machine with minimum 1GB RAM will be enough if you are hosting a million dollar website
    • Fast & stable internet connection / Business Internet Plan for your office
    • Dedicated IP address from your Internet Service Provider
    • UPS / Power Backup
    • cPanel license

    That is all we need, so lets get started.

    The first thing we need to do is install a non GUI version of CentOS 7 (NetInstall version) which is available for FREE to download, install and use. After installing the CentOS, we will have the root login which we will use to login to the CentOS and install the web hosting control panel.

    From shell, we will install cPanel using the command: (Note that cPanel is a paid software and you need a license to install and activate it)

    cd /home && curl -o latest -L https://securedownloads.cpanel.net/latest && sh latest

    The cPanel installation will take about 10 minutes and once the installation is complete, you will need to take further steps to be able to access the WHM and cPanel ports.

    The next step would be to open the ports 2083 and 2087 on your router. Also if you are not directly connecting the router to the machine, then you will need to forward ports to the local network IP which has been granted to your server machine. Once this is done, you will need to open your browser on a different machine and type:


    It may not yet have the SSL certificate and your browser may ask your permission to continue with the SSL request. Once you hit PROCEED, you will be taken to the WHM login interface. Enter your root login credentials and you will be taken to WHM dashboard.

    Now we need to setup hostname, search for “hostname” option and open it. Whatever domain you want to use it with the server, use a subdomain such as server.yourdomain.com in the host name option and save it. Also you will need to update your DNS records of the domain to point subdomain to your IP. After completing this process, you would be able to access your server using https://server.yourdomain.com:2087

    Now that we have access to WHM, lets create a hosting account and login to cPanel using the credentials generated. On the side, you can also modify the DNS records for your domain to point to your server IP. This will allow your domain to be pointed to your server and thus start loading the files that are hosting on the account created.

    Important things to note here:

    A dedicated IP is required but is not a must, You can test with a dynamic IP and request a cPanel 15 day test license if you want to test cpanel and your server environment before finalizing everything.

    Also, a power¬† backup is must as a server need to be online 24×7 so that your clients are always able to reach your website.

    If you want to use cPanel email functionality, then you will need to open all email ports (IMAP, SMTP, POP) for the server to be able to receive and send email. Other than that, you will need to open other ports for services such as FTP, SSH etc to be able to communicate with server on these ports from outside your local network.

    Other functionality that you can configure on cPanel:

    This is the basic method to get a web server up and running in no time, but there are other things that need to be taken care of. First is the backups, which are critical and you need to make sure that you configure them in case of a disaster recovery situation. Local backups are not recommended due to cases such as local Hard Disk failure where the website and backup, both will be lost together.

    Also, the quality of the hardware also determines your success rate. Try to purchase a system that is durable and you can rely on.

    Also, RAID setup is recommended for advanced users with knowledge of how to duplicate data across disks.

    Let us know if you have any question or if you want us to manage your local servers or want to switch to cPanel for better stability or need us to strengthen your server security.