How to make a HTML file on Apache webserver accessible from other devices and locations via a web browser












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.










share|improve this question





























    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.










    share|improve this question



























      0












      0








      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.










      share|improve this question
















      [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.







      16.04 networking server apache2 html






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 5 at 19:09







      Ruairí Másún

















      asked Jan 5 at 18:59









      Ruairí MásúnRuairí Másún

      95




      95






















          2 Answers
          2






          active

          oldest

          votes


















          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.)






          share|improve this answer































            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



            <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





            share|improve this answer


























            • Thanks, I will try this out. By the way, I was advise by a friend who does CS not to use the :80 port, and to use another one instead. Is he right, or is there any reason in not wanting to use the :80 port?

              – Ruairí Másún
              Jan 5 at 19:20











            • httpd.apache.org/docs/2.4/vhosts/examples.html read this. Port 80 is used for http making it a reserve port.

              – thirteen3054
              Jan 5 at 19:34






            • 1





              @RuairíMásún if you intend http://domain.tld/ to go directrly to the site you need to use port 80. Your friend who does "CS" is not familiar with IT networking, but they're probably trying to shield you from typical HTTP based attack vectors and port scanners, but that's just security through obscurity and is useless in the long run. (FYI: I'm an IT Security professional so I'm speaking from some levels of experience here.)

              – Thomas Ward
              Jan 5 at 19:35











            • If you have a custom application that does not run as root or doesn't get served directly by Apache, then yes you would use port 8000. But that's not the case when Apache itself is serving the files.

              – Thomas Ward
              Jan 5 at 19:36











            • I can't create a new file in the /etc/apache2/sites-available directory directly. Am I able to do this using Terminal? If so, how do I do it? I've opened the Terminal in that directory.

              – Ruairí Másún
              Jan 5 at 19:55











            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1107241%2fhow-to-make-a-html-file-on-apache-webserver-accessible-from-other-devices-and-lo%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            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.)






            share|improve this answer




























              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.)






              share|improve this answer


























                0












                0








                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.)






                share|improve this answer













                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.)







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 5 at 19:27









                E. YagmahanE. Yagmahan

                465




                465

























                    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



                    <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





                    share|improve this answer


























                    • Thanks, I will try this out. By the way, I was advise by a friend who does CS not to use the :80 port, and to use another one instead. Is he right, or is there any reason in not wanting to use the :80 port?

                      – Ruairí Másún
                      Jan 5 at 19:20











                    • httpd.apache.org/docs/2.4/vhosts/examples.html read this. Port 80 is used for http making it a reserve port.

                      – thirteen3054
                      Jan 5 at 19:34






                    • 1





                      @RuairíMásún if you intend http://domain.tld/ to go directrly to the site you need to use port 80. Your friend who does "CS" is not familiar with IT networking, but they're probably trying to shield you from typical HTTP based attack vectors and port scanners, but that's just security through obscurity and is useless in the long run. (FYI: I'm an IT Security professional so I'm speaking from some levels of experience here.)

                      – Thomas Ward
                      Jan 5 at 19:35











                    • If you have a custom application that does not run as root or doesn't get served directly by Apache, then yes you would use port 8000. But that's not the case when Apache itself is serving the files.

                      – Thomas Ward
                      Jan 5 at 19:36











                    • I can't create a new file in the /etc/apache2/sites-available directory directly. Am I able to do this using Terminal? If so, how do I do it? I've opened the Terminal in that directory.

                      – Ruairí Másún
                      Jan 5 at 19:55
















                    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



                    <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





                    share|improve this answer


























                    • Thanks, I will try this out. By the way, I was advise by a friend who does CS not to use the :80 port, and to use another one instead. Is he right, or is there any reason in not wanting to use the :80 port?

                      – Ruairí Másún
                      Jan 5 at 19:20











                    • httpd.apache.org/docs/2.4/vhosts/examples.html read this. Port 80 is used for http making it a reserve port.

                      – thirteen3054
                      Jan 5 at 19:34






                    • 1





                      @RuairíMásún if you intend http://domain.tld/ to go directrly to the site you need to use port 80. Your friend who does "CS" is not familiar with IT networking, but they're probably trying to shield you from typical HTTP based attack vectors and port scanners, but that's just security through obscurity and is useless in the long run. (FYI: I'm an IT Security professional so I'm speaking from some levels of experience here.)

                      – Thomas Ward
                      Jan 5 at 19:35











                    • If you have a custom application that does not run as root or doesn't get served directly by Apache, then yes you would use port 8000. But that's not the case when Apache itself is serving the files.

                      – Thomas Ward
                      Jan 5 at 19:36











                    • I can't create a new file in the /etc/apache2/sites-available directory directly. Am I able to do this using Terminal? If so, how do I do it? I've opened the Terminal in that directory.

                      – Ruairí Másún
                      Jan 5 at 19:55














                    0












                    0








                    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



                    <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





                    share|improve this answer















                    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






                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Jan 5 at 19:38

























                    answered Jan 5 at 19:16









                    thirteen3054thirteen3054

                    64




                    64













                    • Thanks, I will try this out. By the way, I was advise by a friend who does CS not to use the :80 port, and to use another one instead. Is he right, or is there any reason in not wanting to use the :80 port?

                      – Ruairí Másún
                      Jan 5 at 19:20











                    • httpd.apache.org/docs/2.4/vhosts/examples.html read this. Port 80 is used for http making it a reserve port.

                      – thirteen3054
                      Jan 5 at 19:34






                    • 1





                      @RuairíMásún if you intend http://domain.tld/ to go directrly to the site you need to use port 80. Your friend who does "CS" is not familiar with IT networking, but they're probably trying to shield you from typical HTTP based attack vectors and port scanners, but that's just security through obscurity and is useless in the long run. (FYI: I'm an IT Security professional so I'm speaking from some levels of experience here.)

                      – Thomas Ward
                      Jan 5 at 19:35











                    • If you have a custom application that does not run as root or doesn't get served directly by Apache, then yes you would use port 8000. But that's not the case when Apache itself is serving the files.

                      – Thomas Ward
                      Jan 5 at 19:36











                    • I can't create a new file in the /etc/apache2/sites-available directory directly. Am I able to do this using Terminal? If so, how do I do it? I've opened the Terminal in that directory.

                      – Ruairí Másún
                      Jan 5 at 19:55



















                    • Thanks, I will try this out. By the way, I was advise by a friend who does CS not to use the :80 port, and to use another one instead. Is he right, or is there any reason in not wanting to use the :80 port?

                      – Ruairí Másún
                      Jan 5 at 19:20











                    • httpd.apache.org/docs/2.4/vhosts/examples.html read this. Port 80 is used for http making it a reserve port.

                      – thirteen3054
                      Jan 5 at 19:34






                    • 1





                      @RuairíMásún if you intend http://domain.tld/ to go directrly to the site you need to use port 80. Your friend who does "CS" is not familiar with IT networking, but they're probably trying to shield you from typical HTTP based attack vectors and port scanners, but that's just security through obscurity and is useless in the long run. (FYI: I'm an IT Security professional so I'm speaking from some levels of experience here.)

                      – Thomas Ward
                      Jan 5 at 19:35











                    • If you have a custom application that does not run as root or doesn't get served directly by Apache, then yes you would use port 8000. But that's not the case when Apache itself is serving the files.

                      – Thomas Ward
                      Jan 5 at 19:36











                    • I can't create a new file in the /etc/apache2/sites-available directory directly. Am I able to do this using Terminal? If so, how do I do it? I've opened the Terminal in that directory.

                      – Ruairí Másún
                      Jan 5 at 19:55

















                    Thanks, I will try this out. By the way, I was advise by a friend who does CS not to use the :80 port, and to use another one instead. Is he right, or is there any reason in not wanting to use the :80 port?

                    – Ruairí Másún
                    Jan 5 at 19:20





                    Thanks, I will try this out. By the way, I was advise by a friend who does CS not to use the :80 port, and to use another one instead. Is he right, or is there any reason in not wanting to use the :80 port?

                    – Ruairí Másún
                    Jan 5 at 19:20













                    httpd.apache.org/docs/2.4/vhosts/examples.html read this. Port 80 is used for http making it a reserve port.

                    – thirteen3054
                    Jan 5 at 19:34





                    httpd.apache.org/docs/2.4/vhosts/examples.html read this. Port 80 is used for http making it a reserve port.

                    – thirteen3054
                    Jan 5 at 19:34




                    1




                    1





                    @RuairíMásún if you intend http://domain.tld/ to go directrly to the site you need to use port 80. Your friend who does "CS" is not familiar with IT networking, but they're probably trying to shield you from typical HTTP based attack vectors and port scanners, but that's just security through obscurity and is useless in the long run. (FYI: I'm an IT Security professional so I'm speaking from some levels of experience here.)

                    – Thomas Ward
                    Jan 5 at 19:35





                    @RuairíMásún if you intend http://domain.tld/ to go directrly to the site you need to use port 80. Your friend who does "CS" is not familiar with IT networking, but they're probably trying to shield you from typical HTTP based attack vectors and port scanners, but that's just security through obscurity and is useless in the long run. (FYI: I'm an IT Security professional so I'm speaking from some levels of experience here.)

                    – Thomas Ward
                    Jan 5 at 19:35













                    If you have a custom application that does not run as root or doesn't get served directly by Apache, then yes you would use port 8000. But that's not the case when Apache itself is serving the files.

                    – Thomas Ward
                    Jan 5 at 19:36





                    If you have a custom application that does not run as root or doesn't get served directly by Apache, then yes you would use port 8000. But that's not the case when Apache itself is serving the files.

                    – Thomas Ward
                    Jan 5 at 19:36













                    I can't create a new file in the /etc/apache2/sites-available directory directly. Am I able to do this using Terminal? If so, how do I do it? I've opened the Terminal in that directory.

                    – Ruairí Másún
                    Jan 5 at 19:55





                    I can't create a new file in the /etc/apache2/sites-available directory directly. Am I able to do this using Terminal? If so, how do I do it? I've opened the Terminal in that directory.

                    – Ruairí Másún
                    Jan 5 at 19:55


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1107241%2fhow-to-make-a-html-file-on-apache-webserver-accessible-from-other-devices-and-lo%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                    Mangá

                     ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕