Why apache2 is rendering only index.html











up vote
0
down vote

favorite












I want to redirect the apache to a directory in my server to render from the index.html, I am using ubuntu 14.04 server.










share|improve this question
























  • Have a look at /etc/apache2/sites-enabled/000-default.conf that will have an entry DocumentRoot, that is where your files are being served from. Very likely: DocumentRoot /var/www/html
    – NZD
    Apr 2 '16 at 6:33















up vote
0
down vote

favorite












I want to redirect the apache to a directory in my server to render from the index.html, I am using ubuntu 14.04 server.










share|improve this question
























  • Have a look at /etc/apache2/sites-enabled/000-default.conf that will have an entry DocumentRoot, that is where your files are being served from. Very likely: DocumentRoot /var/www/html
    – NZD
    Apr 2 '16 at 6:33













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I want to redirect the apache to a directory in my server to render from the index.html, I am using ubuntu 14.04 server.










share|improve this question















I want to redirect the apache to a directory in my server to render from the index.html, I am using ubuntu 14.04 server.







ubuntu apache-httpd






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 at 22:44









Rui F Ribeiro

38.3k1477127




38.3k1477127










asked Apr 2 '16 at 3:51









Suba

1




1












  • Have a look at /etc/apache2/sites-enabled/000-default.conf that will have an entry DocumentRoot, that is where your files are being served from. Very likely: DocumentRoot /var/www/html
    – NZD
    Apr 2 '16 at 6:33


















  • Have a look at /etc/apache2/sites-enabled/000-default.conf that will have an entry DocumentRoot, that is where your files are being served from. Very likely: DocumentRoot /var/www/html
    – NZD
    Apr 2 '16 at 6:33
















Have a look at /etc/apache2/sites-enabled/000-default.conf that will have an entry DocumentRoot, that is where your files are being served from. Very likely: DocumentRoot /var/www/html
– NZD
Apr 2 '16 at 6:33




Have a look at /etc/apache2/sites-enabled/000-default.conf that will have an entry DocumentRoot, that is where your files are being served from. Very likely: DocumentRoot /var/www/html
– NZD
Apr 2 '16 at 6:33










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Apache2 has the concept of sites, which are separate configuration files that Apache2 will read. These are available in /etc/apache2/sites-available. By default, there is one site available called 000-default. This is what you will see when you browse to http://localhost or http://127.0.0.1. You can have many different site configurations available, and activate only those that you need.



As an example, you want the default site to be /home/user/public_html/index.html. To do this, we must create a new site and then enable it in Apache2.



To create a new site:



Copy the default website as a starting point:



sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mysite.conf 


Edit the new configuration file in a text editor sudo nano on the command line or gksudo gedit, for example:



gksudo gedit /etc/apache2/sites-available/mysite.conf


Change the DocumentRoot to point to the new location. For example,



/home/user/public_html/


In the file: /etc/apache2/apache2.conf, change the Directory directive, replace <Directory /var/www/> to <Directory /home/user/public_html/>



You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites



Save the file
Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite (apache2enable site) and a2dissite (apache2disable site).



sudo a2dissite 000-default && sudo a2ensite mysite


Finally, we restart Apache2:



sudo /etc/init.d/apache2 restart


If you have not created /home/user/public_html/index.html, you will receive an warning message.






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    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',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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%2funix.stackexchange.com%2fquestions%2f273778%2fwhy-apache2-is-rendering-only-index-html%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Apache2 has the concept of sites, which are separate configuration files that Apache2 will read. These are available in /etc/apache2/sites-available. By default, there is one site available called 000-default. This is what you will see when you browse to http://localhost or http://127.0.0.1. You can have many different site configurations available, and activate only those that you need.



    As an example, you want the default site to be /home/user/public_html/index.html. To do this, we must create a new site and then enable it in Apache2.



    To create a new site:



    Copy the default website as a starting point:



    sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mysite.conf 


    Edit the new configuration file in a text editor sudo nano on the command line or gksudo gedit, for example:



    gksudo gedit /etc/apache2/sites-available/mysite.conf


    Change the DocumentRoot to point to the new location. For example,



    /home/user/public_html/


    In the file: /etc/apache2/apache2.conf, change the Directory directive, replace <Directory /var/www/> to <Directory /home/user/public_html/>



    You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites



    Save the file
    Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite (apache2enable site) and a2dissite (apache2disable site).



    sudo a2dissite 000-default && sudo a2ensite mysite


    Finally, we restart Apache2:



    sudo /etc/init.d/apache2 restart


    If you have not created /home/user/public_html/index.html, you will receive an warning message.






    share|improve this answer



























      up vote
      0
      down vote













      Apache2 has the concept of sites, which are separate configuration files that Apache2 will read. These are available in /etc/apache2/sites-available. By default, there is one site available called 000-default. This is what you will see when you browse to http://localhost or http://127.0.0.1. You can have many different site configurations available, and activate only those that you need.



      As an example, you want the default site to be /home/user/public_html/index.html. To do this, we must create a new site and then enable it in Apache2.



      To create a new site:



      Copy the default website as a starting point:



      sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mysite.conf 


      Edit the new configuration file in a text editor sudo nano on the command line or gksudo gedit, for example:



      gksudo gedit /etc/apache2/sites-available/mysite.conf


      Change the DocumentRoot to point to the new location. For example,



      /home/user/public_html/


      In the file: /etc/apache2/apache2.conf, change the Directory directive, replace <Directory /var/www/> to <Directory /home/user/public_html/>



      You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites



      Save the file
      Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite (apache2enable site) and a2dissite (apache2disable site).



      sudo a2dissite 000-default && sudo a2ensite mysite


      Finally, we restart Apache2:



      sudo /etc/init.d/apache2 restart


      If you have not created /home/user/public_html/index.html, you will receive an warning message.






      share|improve this answer

























        up vote
        0
        down vote










        up vote
        0
        down vote









        Apache2 has the concept of sites, which are separate configuration files that Apache2 will read. These are available in /etc/apache2/sites-available. By default, there is one site available called 000-default. This is what you will see when you browse to http://localhost or http://127.0.0.1. You can have many different site configurations available, and activate only those that you need.



        As an example, you want the default site to be /home/user/public_html/index.html. To do this, we must create a new site and then enable it in Apache2.



        To create a new site:



        Copy the default website as a starting point:



        sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mysite.conf 


        Edit the new configuration file in a text editor sudo nano on the command line or gksudo gedit, for example:



        gksudo gedit /etc/apache2/sites-available/mysite.conf


        Change the DocumentRoot to point to the new location. For example,



        /home/user/public_html/


        In the file: /etc/apache2/apache2.conf, change the Directory directive, replace <Directory /var/www/> to <Directory /home/user/public_html/>



        You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites



        Save the file
        Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite (apache2enable site) and a2dissite (apache2disable site).



        sudo a2dissite 000-default && sudo a2ensite mysite


        Finally, we restart Apache2:



        sudo /etc/init.d/apache2 restart


        If you have not created /home/user/public_html/index.html, you will receive an warning message.






        share|improve this answer














        Apache2 has the concept of sites, which are separate configuration files that Apache2 will read. These are available in /etc/apache2/sites-available. By default, there is one site available called 000-default. This is what you will see when you browse to http://localhost or http://127.0.0.1. You can have many different site configurations available, and activate only those that you need.



        As an example, you want the default site to be /home/user/public_html/index.html. To do this, we must create a new site and then enable it in Apache2.



        To create a new site:



        Copy the default website as a starting point:



        sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mysite.conf 


        Edit the new configuration file in a text editor sudo nano on the command line or gksudo gedit, for example:



        gksudo gedit /etc/apache2/sites-available/mysite.conf


        Change the DocumentRoot to point to the new location. For example,



        /home/user/public_html/


        In the file: /etc/apache2/apache2.conf, change the Directory directive, replace <Directory /var/www/> to <Directory /home/user/public_html/>



        You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites



        Save the file
        Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite (apache2enable site) and a2dissite (apache2disable site).



        sudo a2dissite 000-default && sudo a2ensite mysite


        Finally, we restart Apache2:



        sudo /etc/init.d/apache2 restart


        If you have not created /home/user/public_html/index.html, you will receive an warning message.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 5 '16 at 14:50









        Evgeny Lebedev

        13515




        13515










        answered Apr 2 '16 at 9:12









        A Yashpal

        765




        765






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


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





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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%2funix.stackexchange.com%2fquestions%2f273778%2fwhy-apache2-is-rendering-only-index-html%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

            Morgemoulin

            Scott Moir

            Souastre