Below are the steps to change document root in Apache(Web server) configurations -
[root@rhcsa107 rakesh]# mkdir /web
[root@rhcsa107 rakesh]# ls -ld /web/
drwxr-xr-x. 2 root root 22 Apr 3 08:45 /web/
[root@rhcsa107 rakesh]# vim /etc/httpd/conf.d/rakesh.conf
[root@rhcsa107 rakesh]# mkdir /web
[root@rhcsa107 rakesh]# ls -ld /web/
drwxr-xr-x. 2 root root 22 Apr 3 08:45 /web/
[root@rhcsa107 rakesh]# vim /etc/httpd/conf.d/rakesh.conf
DocumentRoot /web
<Directory /web>
Require all granted
</Directory>
Save exit from from this file.
[root@rhcsa107 rakesh]# systemctl restart httpd.service
Check HTTPD status, it must be running as below -
[root@rhcsa107 rakesh]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2020-04-03 09:19:46 EDT; 6min ago
Docs: man:httpd.service(8)
Main PID: 10064 (httpd)
Status: "Total requests: 5; Idle/Busy workers 100/0;Requests/sec: 0.0129; Bytes served/sec: 9 B/sec"
Tasks: 278 (limit: 11516)
Memory: 36.1M
CGroup: /system.slice/httpd.service
├─10064 /usr/sbin/httpd -DFOREGROUND
├─10065 /usr/sbin/httpd -DFOREGROUND
├─10066 /usr/sbin/httpd -DFOREGROUND
├─10067 /usr/sbin/httpd -DFOREGROUND
├─10068 /usr/sbin/httpd -DFOREGROUND
└─10288 /usr/sbin/httpd -DFOREGROUND
Apr 03 09:19:46 rhcsa107.example.com systemd[1]: Starting The Apache HTTP Server...
Apr 03 09:19:46 rhcsa107.example.com httpd[10064]: Server configured, listening on: port 80
Apr 03 09:19:46 rhcsa107.example.com systemd[1]: Started The Apache HTTP Server.
[root@rhcsa107 rakesh]#
<Directory /web>
Require all granted
</Directory>
Save exit from from this file.
[root@rhcsa107 rakesh]# systemctl restart httpd.service
Check HTTPD status, it must be running as below -
[root@rhcsa107 rakesh]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2020-04-03 09:19:46 EDT; 6min ago
Docs: man:httpd.service(8)
Main PID: 10064 (httpd)
Status: "Total requests: 5; Idle/Busy workers 100/0;Requests/sec: 0.0129; Bytes served/sec: 9 B/sec"
Tasks: 278 (limit: 11516)
Memory: 36.1M
CGroup: /system.slice/httpd.service
├─10064 /usr/sbin/httpd -DFOREGROUND
├─10065 /usr/sbin/httpd -DFOREGROUND
├─10066 /usr/sbin/httpd -DFOREGROUND
├─10067 /usr/sbin/httpd -DFOREGROUND
├─10068 /usr/sbin/httpd -DFOREGROUND
└─10288 /usr/sbin/httpd -DFOREGROUND
Apr 03 09:19:46 rhcsa107.example.com systemd[1]: Starting The Apache HTTP Server...
Apr 03 09:19:46 rhcsa107.example.com httpd[10064]: Server configured, listening on: port 80
Apr 03 09:19:46 rhcsa107.example.com systemd[1]: Started The Apache HTTP Server.
[root@rhcsa107 rakesh]#
Comments
Post a Comment
Please share your experience.....