sudo chown -R $USER : $USER /var/www/ /public_html.If we want our regular user to be able to modify files in our web directories, we can change the ownership by doing this: Now we have the directory structure for our files, but they are owned by our root user. The portions in red represent the domain names that we are wanting to serve from our VPS. This gives us some flexibility in our hosting.įor instance, for our sites, we’re going to make our directories like this: Our document root (the top-level directory that Apache looks at to find content to serve) will be set to individual directories under the /var/Within each of these directories, we will create a public_html folder that will hold our actual files. The first step that we are going to take is to make a directory structure that will hold the site data that we will be serving to visitors. Step 1 - Creating the Directory Structure This will allow you to test your configuration from your home computer, even though your content won’t be available through the domain name to other visitors. We will show how to edit your local hosts file later on to test the configuration if you are using dummy values. These will be referenced throughout the guide, but you should substitute your own domains or values while following along. If you haven’t already done so, you can get Apache installed on your server through apt-get:Īfter these steps are complete, we can get started.įor the purposes of this guide, our configuration will make a virtual host for and another for. You will also need to have Apache installed in order to work through these steps. Prerequisitesīefore you begin this tutorial, you should create a sudo-enabled non- root user as described in steps 1–4 here. During this process, you’ll learn how to serve different content to different visitors depending on which domains they are requesting. In this guide, we will walk you through how to set up Apache virtual hosts on an Ubuntu 16.04 server. This scheme is expandable without any software limit as long as your server can handle the load. This is relevant to anyone looking to host more than one site off of a single server.Įach domain that is configured will direct the visitor to a specific directory holding that site’s information, never indicating that the same server is also responsible for other sites. These designations allow the administrator to use one server to host multiple domains or sites off of a single interface or IP by using a matching mechanism. The basic unit that describes an individual site or domain is called a virtual host. It accounts for more than half of all active websites on the internet and is extremely powerful and flexible.Īpache breaks its functionality and components into individual units that can be customized and configured independently. The Apache web server is the most popular way of serving web content on the internet.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |