I cant change my web root in apache, for some reason it points to /Sites/folder1/folder2 instead of it pointing to /Sites.
I configured and change my apache
<Directory "/Users/saad/Sites">
and
DocumentRoot /Users/saad/Sites
restarted my apachectl and still nothing.
The document root for your apache server, by default, is "Sites" in your home directory. That's not the root folder. Root is http://localhost/ . The folder you're refering to is located at http://localhost/~User/ .
Apache and php comes pre installed in mac OS Big Sur, You will just need to activate them using terminal. To start apache type the following command in the terminal and run. You need to write “sudo” before the actual command. We use sudo, which stands for “super-user do,” to run apps with higher rights.
I just meet this problem, too. I need to change the DocumentRoot and point it to my customised directory, which used for saving image files.
Berkay is right, you need edit a bit on your apache httpd.config file, but besides that, you need to do one more change, otherwise the WebSharing won't be able to turn on again.
Open your httpd.config by your favorite editor (Probably need to do this if you haven't change the permission access to this file)
Find DocumentRoot "/Library/WebServer/Documents"
, and change it to DocumentRoot "/Users/leiwang/Sites"
or any other folders you want to.
One important thing is, you need to give the Read/Write permission to the folder you specified.
Hope it helps:)
there is a documentroot property in the /etc/apache2/httpd.conf on osx. so we can easily change the path like this;
DocumentRoot "{YOUR_ROOT_PATH}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With