How do I set the Apache document root?

How do I set the Apache document root?

8 Answers

  1. To change Apache’s root directory, run: cd /etc/apache2/sites-available.
  2. Then open the 000-default.conf file using the command: nano 000-default.conf.
  3. Edit the DocumentRoot option: DocumentRoot /path/to/my/project.
  4. Then restart the apache server: sudo service apache2 restart.

How do I make a folder for my website on a Mac?

Create a folder

  1. On your Mac, click the Finder icon in the Dock to open a Finder window, then navigate to where you want to create the folder.
  2. Choose File > New Folder, or press Shift-Command-N.
  3. Enter a name for the folder, then press Return.

Where is my Apache root directory on Mac?

The document root for your apache server, by default, is “Sites” in your home directory. open the ‘Finder’ in Mac and Command+Shift+G and type in the path:/usr/local/zend/apache2/htdocs.

What is the command to stop Apache?

Stopping apache:

  1. Log in as the application user.
  2. Type apcb.
  3. If apache was run as the application user: Type ./apachectl stop.

How to change document root for Apache2 in Mac?

To follow on from @Bred Ackerman answer if your using apache vhost you will need to add: private/etc/apache2/extra/httpd-vhosts.conf Thanks for contributing an answer to Server Fault!

Where is the default root of a document?

The default location of Document root as per httpd.conf is /Library/WebServer/Documents. I want this location to be /webcontent. So to do that, I created a webcontent folder in root (/).

How to set up Apache on a Mac?

First, we’re going to create a Sites directory within your Mac’s home directory using Terminal. To do this, we’ll use the mkdir command, short for make directory, with the text after the command representing the path and directory name we wish to create.

Do you need Apache server for macOS Sierra?

New features and enhancements are in store for macOS Sierra, but as web developers, we know that major OS updates can leave things a bit odd depending upon our development environments. For example, a previously working Apache web server in El Capitan will more than likely need to be reconfigured for Sierra.