0

[I have already installed and set up Apache2; this is not a duplicate question, please see below]

I have uploaded a HTML file to the Apache2 localhost web server, using the default :8000 port. I want this file to be accessible via a web browser on another device in another location, by entering a WWW domain into a search engine. In other words, I want to create a fully accessible website while keeping the HTML files for my website on the Apache web server.

I would appreciate any help I can get.

3 Answers3

1

Place the file like this /var/www/html/index.html. Then go to /etc/apache2/sites-available, here create a file index.conf and add the following

<VirtualHost *:80>
        ServerName test.com
        ServerAdmin info@test.com
        ServerAlias www.test.com
        DocumentRoot /var/www/html

        <Directory /var/www/html>
                Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

As I did forgot and E. Yagmahan mentioned save your file and run this command:

sudo a2ensite index.conf

This command will enable your configuration file.

After all that run this:

sudo systemctl restart apache2
0

In addition to the answers of thirteen3054:

After creating the new file index.conf you should enable it via:

sudo a2ensite index.conf

Doing that enables the specified site within the apache2 configuration. It does this by creating symlinks within /etc/apache2/sites-enabled. (Likewise, "a2dissite" disables a site by removing those symlinks.)

0

Place the file like this /var/www/html/index.html. Then go to /etc/apache2/sites-available, here create a file index.conf and add the following

ServerName test.com ServerAdmin info@test.com ServerAlias www.test.com DocumentRoot /var/www/html

    <Directory /var/www/html>
            Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

save your file and run this command:

sudo a2ensite index.conf This command will enable your configuration file.

After all that run this: /etc/init.d/apache2 restart