Nk_all_docroots

Home

Description

Get all the document roots on the server.

Example

[root@cloudvpsserver ~]# nk_all_docroots
/home/nkern/public_html

Code

nk_all_docroots() {
    # Get all lines in /etc/apache2/conf/httpd.conf that match "DocumentRoot" and print the last field
    # Then remove /var/www from the results.
    # Finally remove any duplicates.
    awk '/DocumentRoot/ {print $NF}' /etc/apache2/conf/httpd.conf | grep -v "/var/www/html" | sort | uniq
}

Author: Nichole Kernreicht

Created: 2023-04-09 Sun 20:56