To change the document root for your apache web server simply open the corresponding file with your favourite text editor and search for documentroot. Configuring the php development environment in linux ubuntu. When running apache web server, it has what is called a document root directive which is a folder on your local file system. Does anyone know how to change the document root of the apache server. In this video i have discussed and showed how you can change your linux ubuntu server varhtml document root to a folder owned by your linux ubuntu user. You can learn more about how to set up a user with these privileges in our. On red hatbased systems apache runs under the group apache with a document root of varhtml. How to change the document root of the apache server in. On ubuntu, by default, the apache2 web server stores its documents in var html, which is typically located on the root filesystem with rest. On debianbased systems apache runs under the group data with a document root of var. How to create symbolic link to apache document root. Developed by the apache software foundation, it is available for most operating. Install apache web server first of all, you need to install apache web server on you system.
How to change default apache documentroot directory in linux. This is the root folder from which the server will serve the files for an url. Learn how to configure virtual hosts, configure users home directory. In the example above, where the file type for the directory web is changed to allow apache to server files from that directory, run the following command to apply the changes. I have checked their default document root that is. Overwrite global settings in the pertinent configuration files. This directive sets the directory from which apache will serve files. I am in the process to migrate to a new web server and i would like to have a clean and safe file architecture for apache and my web. I have to find code of websites from customers linux ubuntu server. The new document root location is completely configurable based on your needs. How to move apache web root to a new location on ubuntu linux. Usually the site config should be under etcapache2sitesavailablenf.
Create symbolic link in the current web server document root permissions. The default documentroot, for both the nonsecure and secure web. After modifying the configuration file, you have to restartreload your apache web server to make it effective. Hi, i have a problem getting my system to respond to a change in apache document root. By joining our community you will have the ability to post. Usually the siteconfig should be under etcapache2sitesavailablenf. It is often the preferred choice by professionals for building different web projects. How to change default apache documentroot in linux. If you havent already set one up, the apache section of the indepth article, how to install linux, apache, mysql, php lamp stack on ubuntu 16. I thought my server was running apache, as it is a linux server and there are many apache utilities in my cpanel menu, but in my. Here are some additional guides about apache web server, that you. By default, the document root directory for the primary domain is.
Documentroot is the directory which contains most of the html files which are served in response to requests. Apache is a web server that we require to execute php web applications in ubuntu. In deciding what file to serve for a given request, ds default behavior is to take the urlpath for the request. To get the apache documentroot directory on debian, ubuntu linux and its derivatives such as linux mint, run the following grep command. You need superuser privilege to create and modify file inside the default root. Change document root folder of apache web server on linux stack. How to install and setup apache web server in linux.
Update the question so its ontopic for stack overflow. How to change the apache web root to another directory on an ubuntu 18. Web servers are used to serve web pages requested by client computers. By default, varhtml is root directory of apache web server. Copy files optional copy files in the default root directory at your new location, say. This post shows, how to change the document root of the apache server. On red hatbased systems apache runs under the group.
I am creating an rpm and in the pre stage, i want to determine apaches document root so i can copy the web application files there. The document root is specified in the file that defines your virtual host. How do i find out my apache webserver document root under linux unix bsd operating systems. Before going further make sure you have setup linux subsystem for windows 10. Open terminal and run the following command to stop apache server. How to move an apache web root to a new location on ubuntu. How do i change the document root of a linux apache server. How to setup apache, mysql and php in linux subsystem for. Run the rpm q d command to see if the d package is installed. This guide explains how to change apache web server documentroot on. Apache is the most commonly used web server on linux systems. Apache web server is probably the most used web server across platforms including different linux distributions and windows. There are an overwhelming number of options and techniques available to.
How to change the apache web root to another directory on an. The web server is used to deliver web content and can serve many queries at once. I basically want localhost to come from usersspencerprojects directory instead of var. Weve listed the default values for the apache web server running on some linux distributions below. On ubuntu, by default, the apache2 web server stores its documents in varhtml, which is typically located on the root filesystem with rest.
Unless matched by a directive like alias, the server appends the. In deciding what file to serve for a given request, ds default behavior is to take the urlpath for the. This tutorial explains how to configure apache web server in linux step by step with practical examples. Unless matched by a directive like alias, the server appends the path from the requested url to the document root to make the path to the document. The change of default document root is an easy task that can be completed in a couple of minutes. I just watched absolute server paths video second stage of enhancing a simple php application course and i dont get why we are supposed to use.
Apache web server is probably the most used web server across platforms, this tutorial, will guide you on how change default root directory of. Just change inside your virtualhost documentroot var. In deciding what file to serve for a given request. How to change the document root of the apache server in linux. To change the document root for your apache web server simply open the corresponding file. It primarily contains include statements and global settings.
262 1232 1121 1186 185 299 1234 78 632 474 16 1026 1244 1066 589 259 1571 631 1030 1521 1474 815 917 1136 1546 1241 20 993 1005 677 846 938 476 596 198 170 614 138 568 746 862