• Home
  • LLMs
  • Docker
  • Kubernetes
  • Java
  • Maven
  • About
Install | Apache HTTP Server
  1. References
  2. Installation
  3. How to change apache HTTP port?
  4. How to change Apache document root folder?

  1. References
    See this page for more details on how to install Apache HTTP Server:
    https://help.ubuntu.com/lts/serverguide/httpd.html
  2. Installation
    $ sudo apt install apache2

    Change the folder permissions:
    $ sudo chmod -R 775 /var/www/html/
    $ sudo chown -R www-data:www-data /var/www/html/

    Create a symbolic link of the log folder:
    $ sudo ln -s /var/log/apache2/ /etc/apache2/logs

    Configure your server name.
    Add 'ServerName YOUR_SERVER_NAME' in '/etc/apache2/apache2.conf' file:
    $ sudo nano /etc/apache2/apache2.conf
    ServerName mtitekserver

    Restart Apache HTTP Server:
    $ sudo service apache2 restart

    Verify the version of Apache HTTP Server:
    $ apache2ctl -V
    Server version: Apache/2.4.29 (Ubuntu)
    ...

    Access the default page of Apache HTTP Server: http://localhost

    Apache HTTP Server
  3. How to change apache HTTP port?
    See this page for more details on how to configure virtual hosts:
    https://httpd.apache.org/docs/current/vhosts/examples.html

    Change the default port:
    $ sudo vi /etc/apache2/ports.conf
    Listen 8880

    You may have to modify the port in the following file:
    $ sudo vi /etc/apache2/sites-available/000-default.conf
    <VirtualHost *:8880>

    Restart Apache HTTP Server:
    $ sudo service apache2 restart
  4. How to change Apache document root folder?
    Change the DocumentRoot option in the following file:
    $ sudo vi /etc/apache2/sites-available/000-default.conf
    #DocumentRoot /var/www/html
    DocumentRoot /var/www/mtitek

    Restart Apache HTTP Server:
    $ sudo service apache2 restart
© 2025  mtitek