Seamlessly Host, Manage & Grow Your Managed VPS Site
  • Free & Effortless Website Migration
  • 24/7 Worry-Free Support
  • Anytime Money-back Guarantee
See Managed VPS Plans
Spending over 2 hours weekly on growing your website and still using shared hosting?
You Must Read This!

How to Host a Website on VPS Without Control Panel

Virtual Private Server (VPS) is one of the most versatile options where web hosting is concerned. It can be used for almost all purposes from the deployment of web apps to running various complexities of websites or blogs.

The control panel itself isn’t a core part of VPS. In fact, it is actually considered an add-on. Although offering users a friendly way of interacting with the Operating System, you can fully operate your VPS account without a control panel

Prerequisites

The control panel is a Graphic User Interface (GUI) driven method of handling your VPS. Without it, you will need to know the various commands necessary to install and configure the various components needed.

For today we’re going to look at what you need to host a website with the inclusive installation of a database. The components necessary will include the Apache web server, PHP module, and MySQL database.

You will need to have a VPN hosting account ready with an OS pre-installed, along with a domain name. For the purposes of this article I’m going to assume my domain name is called myexample.com.

How to Install a Web Server

The commands needed to install the Apache web server will vary depending on what OS you have chosen. Let’s look at some of the differences needed between a few common variants of OS:

Ubuntu

sudo apt update

sudo apt install apache2

CentOS

sudo yum update 

sudo yum install httpd 

Debian

sudo apt update -y

sudo apt install apache2 -y

OpenSUSE

sudo zypper update

sudo zypper install apache2

As you can see, the commands themselves are relatively simple. In fact, the examples I have shown include an extra step with each. The first line updates the package repository while the second installs the Apache web server.

How to Create a Virtual Host

If you plan on running multiple websites on your server you will need to work with virtual hosts. By default, Apache comes ready to handle these. However, you will need to create one configuration file for each virtual host.

Ubuntu

sudo vi myexample.conf

CentOS

sudo vi /etc/httpd/conf.d/vhost.conf

Debian

sudo vi /etc/apache2/sites-available/myexample.com.conf

OpenSUSE

sudo vi /etc/apache2/vhosts.d/myexample.conf

These commands will allow you to open a virtual host configuration file for editing based on your domain name. Once that file is open, enter the following code. It will be the same for all Linux platforms:

<VirtualHost *:80>

ServerAdmin admin@myexample.com

ServerName myexample.com

ServerAlias www.myexample.com

DocumentRoot /var/www/myexample.com/public_html

ErrorLog ${APACHE_LOG_DIR}/error.log

CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Configure Apache

As with virtual hosts, Apache is managed through the use of configuration files (typically httpd.conf or apache2.conf). For the most basic configuration of Apache web server, you only need to set a few parameters in the configuration file.

How to Host a Website on VPS Without Control Panel, Configure Apache

Listen is used to bind Apache to a specific IP address or port. For example:

Listen 8000

ServerName lets you set the DNS host name or IP address/port. For example:

ServerName myexample.com:8000

ServerRoot identifies the home directory of the Apache installation. For example:

ServerRoot “d:/myexample/apache2”

DocumentRoot is where the server home directory is located. For example:

DocumentRoot “d:/myexample/apache2/htdocs”

<Directory “d:/myexample/apache2/htdocs”>

    Options Indexes FollowSymLinks

    AllowOverride None

    Order allow,deny

    Allow from all

</Directory>

In some instances Apache may work for you without these configurations being set. However, it is best to carry out this step for familiarization as well as to avoid any potential errors messages popping up.

Restart Apache

The following commands are not the only way of restarting the Apache web server. There are alternative ways as well.

Ubuntu

sudo service apache2 restart

CentOS

sudo systemctl restart httpd.service

Debian

sudo service apache2 restart

OpenSUSE

sudo systemctl restart apache2

Setup verification

To test if Apache web server has been correctly installed and configured, use the Apache binary as follows:

sudo apachectl -t

If there are any issues with the configuration, you will get error messages such as the following:

AH00543: apache2: bad user name username

The Apache error log may have more information.

If this occurs you will need to check your Apache web configuration files again. Once it works, you can proceed with the next step.

Upload your Website Files

The fastest and most simple way of moving your website files onto your VPS host is by using a FTP application. While some operating systems have default FTP clients, it is better to choose a more dedicated and secure FTP solution.

One such example is FileZilla, which is free. Whatever your choice, most solutions providers will have two versions of their application – the client and the server versions. YOu only need to download and install the client version.

Once installed, connect to your VPS host and you can begin transferring the files from there. A good FTP client like FileZilla offers you a GUI that helps make the process easier.

Install PHP and MySQL

Before you install either of these, make sure that your Linux distribution is up to date. This will help ensure the process goes smoothly. To update, run:

  • sudo apt-get update
  • sudo apt-get upgrade

Next we can go ahead and install both PHP and MySQL:

  • sudo apt-get install php

OR

  • sudo yum install php
  • sudo apt-get install mysql-server

OR

  • yum install mysql-server

Connect your Website Database, if Needed

If you’re running a website that needs the use of the database, now is the time to make sure it runs and then connect it. As with the other commands demonstrated so far, the one you use will depend on your Linux distribution. 

For example, to start or stop the MySQL daemon:

sudo /etc/init.d/mysqld start

sudo /etc/init.d/mysqld stop

OR

sudo service mysql start

sudo service mysql stop

Once you’ve started MySQL, you will need to create a database in order to enter it’s details in your web application of choice. This needs to be done using the mysql tool which is a command line interface for executing MySQL instructions:

mysql -u root -p

If your installation of MySQL was correct and the command executes, you will note your prompt change to mysql>. 

To create a database:

CREATE DATABASE mydatabase;

Next, create a user account and give it privileges for the database you created:

CREATE USER you@localhost IDENTIFIED BY ‘password’;

GRANT ALL PRIVILEGES ON * . * TO ‘you’@’localhost’;

FLUSH PRIVILEGES;

Depending on your usage of the account, you may wish to restrict it to specific privileges. This can be done by adjusting the permission type value. Examples of privilege types include SELECT, CREATE, and DELETE. 

If you want to grant a user multiple privilege types, but not all, simply separate the privileges with a comma. Once you’ve created the database and user, you can then enter those details into your web application to get it to connect to the database.

Conclusion

This article only covers the very basics of operating a VPS hosting account without the use of a control panel. As you can see, it requires some extent of knowledge on Linux commands. This can raise some challenges to those unfamiliar with command line environments.

This relatively painful experience can be avoided simply by opting for a VPS hosting account that comes with a control panel. If you’re concerned about additional cost, ScalaHosting offers SPanel, which is extremely feature-packed and easy to use.

Best of all, the use of SPanel isn’t subject to licensing fees and it comes as a cost-effective option on ScalaHosting’s Managed Cloud VPS hosting plans. As an alternative, you can also opt to use cPanel but that will significantly increase the cost of your plan.

Frequently Asked Questions

Do I Need cPanel on VPS Hosting?

No. cPanel is a highly commercialized option that helps VPS users. However, it is not the only option. SPanel is much more cost effective and offers many of the same benefits, if not more. SPanel also does not come with excessive licensing fees.

How Does a VPS Work?

VPS, as the name implies, is a virtual server. Each VPS account shares the same hardware as others, but for all intents and purposes they act as individual servers. This means VPS users can configure almost everything about their accounts, including having their choice of OS.

What Can I Run on VPS Hosting?

VPS can be used for almost anything as long as it does not violate the terms of agreement with your hosting provider. For example, you can use it to run websites, operate a database server, or even web applications.

Is it Difficult to Manage a VPS Without a Control Panel?

Unless you are very familiar with command line instructions for not only the OS you want to use, but other applications as well, it can be challenging. I recommend you look towards a cost effective solution like SPanel to avoid complications.

Do I need MySQL?

If what you intend to do with your VPS requires a database, you will need a database server like MySQL. There are alternatives in the market including MariaDB, but your choice will also be dependent on the application that needs the database. 

Was this article helpful?

What’s your goal today?

1. Find the right Managed VPS solution

If you’re looking for industry-leading speed, ease of use and reliability Try ScalaHosting with an unconditional money-back guarantee.

2. Make your website lightning-fast

We guarantee to make your website load in less than 2 seconds on a managed VPS with ScalaHosting or give your money back. Fill out the form, and we’ll be in touch.

Make your website lighting fast—or your money back
Slow websites lose visitors and sales. See how you can surf tsunami sized traffic spikes—or any traffic—with ease with ScalaHosting. Fill out the form, and we’ll be in touch!
Please enter a valid name
Please enter a valid website
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

3. Streamline your clients’ hosting experience

If you’re a web studio or development agency hosting more than 30 websites, schedule a call with Vlad, our co-founder and CTO, and see how we can deliver unmatched value to both your business and your clients.

Photo

Need a custom cluster or professional advice?

Book a meeting and get a free 30-minute consultation with Vlad, co-founder & CTO of Scala Hosting, who will help you select, design and build the right solution - from a single data center cluster to a multi-region & multi-datacenter high availability cluster with hundreds of servers.

Book a free consultation

4. Learn how to grow your website in 2024

An all-star team of SEO and web influencers are sharing their secret knowledge for the first time in years. Learn about the future of SEO, Web Design best practices and the secrets to getting the foundation for your website to thrive. Watch the exclusive webinar.

An Exclusive Insiders Look Behind The SEO and Web Development Curtain