Home   /   DKMIS Blog   /   Softwares

How to Edit or Modify Apache2 Default html page in Ubuntu 18.04, 20.04, 22.04 and 24.04 Desktop

Posted on 27 January 2025 04:13 pm

There are 2 Methods to Edit Apache2 Default html page in Ubuntu 18.04 , 20.04, 22.04 and 24.04 Desktop

1. Using by Terminal

Open your Terminal in Ubuntu 18.04 or 20.04 or 22.04 or 24.04 Desktop

$ sudo nano /var/www/html/index.html

If you want to remove whole code, press and hold ctrl+k button on your keyboard, wait until whole code remove.
and
Write a fresh html code which is need you.
and press ctrl+x
save it by clicking on "Y" and Enter. thats it.

Restart the Apache2 Server : 

$ sudo systemctl restart apache2

2. You can edit this file directly.

Click on Files icon in your Ubuntu Desktop PC
and click on "Other Locations" it is Located in your Left Side Bar.
And click on "Computer" and then click on "var" folder.
Click on "www" folder and then click on "html" folder.  Now "index.html" file appear here.

Click Right button on your mouse on index.html file.
And select "Open With Other Application" and then select "Text Editor". that's it...

If Text Editor not working to Edit index.html file.
Again Open your Terminal in Ubuntu 18.04 or 20.04 Desktop.
Change the owner and folder permissions to /var/www

Like this :

$ sudo chown $USER:$USER -R /var/www
for changing owner

and

$ sudo chmod 755 -R /var/www
for changing folder permissions.

and then Restart Apache2 Server.

$ sudo systemctl restart apache2

that's it...