Getting 404 Not Found for Install and Configure Web Application task

Hi @Inderpreet ,
for the task Install and Configure Web Application , i added the following 2 VirtualHost directives to the default httpd config file at /etc/httpd/conf/httpd.conf and set the permissions and ownerships correctly for the blog and official directories located at /var/www/html respectively .
Listen 8080
<VirtualHost *:8080>
DocumentRoot /var/www/html/blog/
ErrorLog /var/log/httpd/blog/error.log
CustomLog /var/log/httpd/blog/access.log combined

<VirtualHost *:8080>
DocumentRoot /var/www/html/official/
ErrorLog /var/log/httpd/official/error.log
CustomLog /var/log/httpd/official/access.log combined

After restarting the httpd server and test it as follows on the app server
http://localhost:8080/blog/
http://localhost:8080/official/
I get 404 Not Found .

curl  http://localhost:8080/media/
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /media/ was not found on this server.</p>
</body></html>

Do i need to add ServerName for the httpd server to differentiate the 2 virtual hosts or do i need to add some entry in the /etc/hosts file .
Can you please let me know what is wrong in my setup . Thanks

Hi @kodekloud-support3 or anyone , can you please help with the above question

Hey, @antonysavio1111, sorry for the late reply.
You should not change the DocumentRoot or add anything to /etc/httpd/conf/httpd.conf file other than changing the listen port.
To access a /blog in your case, just add /blog to the end of localhost or the load balancer.

“Do i need to add ServerName for the httpd server to differentiate the 2 virtual hosts or do i need to add some entry in the /etc/hosts file?”
No, just copy the folders to /var/www/html/ and they would be distinguished on their own.
Hope this makes sense.
Cheers

Hi @Chudo , thanks for the response . But just to be clear , do i not need to add VirtualHost directives anywhere ? What you mentioned should work for me , but just wanted to confirm

Thanks @Chudo your advice worked !!

Glad it worked. Cheers!