When the installation process is finished, Unix/Linux users should automatically stop the Apache service from running as the root user. As the root user, stop the Apache service with the command:
Create a new user and group with the command:
useradd -c "Apache" -g apache -p passwd1 apache
And then edit the /etc/apache2/envvars file and change the following two lines to cause Apache to run as the new user:
Apache sets the default document root as /var/www/html. You can leave this alone and change the ownership to the new Apache user, or you can create a new directory for the new document root. If you create a new directory, you have a few more commands to run.
Create a new configuration file in /etch/apache2/sites-available with the command:
cp /etc/apache2/sites-available/default /etc/apache2/sites-available/your_site
Then open the your_site configuration file in any text editor. You will need to change the DocumentRoot directive under the <VirtualHost *:80> section to reflect your new document root.
Disable the default site with the command:
Enable the new site with the command:
Restart the Apache service with the command: