Set up a Web Server and Host a Website on Linode
Updated by Linode Written by Linode
Host a Website on Your Linode
Hosting a website is one of the most common uses for a Linode. A website can be anything from a single HTML file to an interactive application with multiple components, and the hosting process varies greatly depending on the type of website being served. This guide walks you through the process of setting up some of the most common simple website types.
This guide is written for Debian 9 and Ubuntu 18.04. If you are using a different distribution, adapt the commands (e.g. using
yum instead of
Set Up a Web Server
The application you use to serve your website depends on the type of site. Find the section below that matches your situation.
If you plan to host a simple site such as a blog or photo gallery, another option is to use a static site generator.
sudo apt install nginx
Create an NGINX configuration file called
/etc/nginx/conf.d/example.com.conf(replace this and each instance of
example.comwith your site’s name) and add the following content:
1 2 3 4 5 6 7 8 9 10 11
The configuration above tells NGINX to look for your site’s files in
/var/www/example.com. Create this directory now, substituting your domain name for
sudo mkdir -p /var/www/example.com
Give ownership of this directory to your limited user account:
sudo chown username:username /var/www/example.com
Disable the default NGINX welcome page:
sudo rm /etc/nginx/sites-enabled/default
Test the NGINX configuration for errors:
sudo nginx -t
If there are no errors, reload the configuration:
sudo nginx -s reload
Copy the static files from your local computer to the target directory on your Linode. There are many ways to accomplish this. For example, if your site files are stored in a directory called
my-websiteon your computer, you can use
scpfrom your local computer:
scp -r my-website/* username@<linode-ip-address>:/var/www/example.com/
Activate the firewall using the built-in NGINX plugin for UFW:
sudo ufw allow 'NGINX Full' sudo ufw allow ssh sudo ufw enable
Check that NGINX loaded successfully:
sudo systemctl status nginx
If NGINX loads successfully, continue to the Test your Website section below.
This configuration is sufficient to get you started. For more advanced options and optimizations, see our series on NGINX configuration.
Other sites, such as WordPress, need a database in addition to a web server. This combination is known as a stack. WordPress is often used with the extremely popular LAMP stack (Linux, Apache, MariaDB and PHP). To install a LAMP stack manually, find the guide for your distribution in our LAMP section.
If you are using WordPress, another option is to use Docker. All of the components needed to run WordPress, along with WordPress itself, are bundled into a container that can be deployed with single command. Official Docker images are also available for other CMS platforms including Ghost and Joomla.
Other Site Types
Test your Website
Test your website(s) before you add DNS records and make the site available publicly on your domain. Enter your Linode’s public IP address in the address bar of a web browser. You should see your website displayed. When you are confident that the site is functioning correctly, proceed to the next section.
Add DNS Records
In order to point your domain name at your Linode, you will have to add DNS records. DNS changes can take up to 24 hours to propagate across the internet.
Log in to the Linode Manager.
Click the DNS Manager tab.
Select the Add a domain zone link. The form shown below appears.
In the Domain field, enter your website’s domain name in the Domain field.
In the SOA Email field, enter the administrative contact email address for your domain.
Select the Yes, insert a few records to get me started button.
Click Add a Master Zone. Several DNS records will be created for your domain, as shown below.
Through your domain registrar (where you bought the domain), make sure that your domain name is set to use Linode’s DNS. Use your domain name registrar’s interface to set the name servers for your domain to the following:
DNS changes can take up to 48 hours to propagate through the Internet. Once the changes are completed, you will be able to access your website by typing the domain name into your browser’s address bar.
Set Reverse DNS
Log in to the Linode Manager.
Click the Linodes tab.
Select your Linode.
Click the Remote Access tab.
Select the Reverse DNS link, as shown below.
Enter the domain in the Hostname field, as shown below.
Click Look up. A message appears, indicating that a match has been found.
Join our Community
This guide is published under a CC BY-ND 4.0 license.