Ubuntu Apache2 DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







9















I have a web server running Ubuntu 17.04 that I am attempting to set up with Apache. Everything ran great until I decided to host two websites on a single machine through virtualHosts. Now apache refuses to start up with even a single host enabled. Each time I attempt to start Apache I get this error:



apache2: Syntax error on line 80 of /etc/apache2/apache2.conf:
DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot.


None of my attempts to fix this have come to anything including:



apt purge apache2 && rm -r /etc/apache2 


All line 80 of the error message tells me is DefaultRuntimeDir ${APACHE_RUN_DIR}.



And at no time do I see where or what APACHE_RUN_DIR is declared as.



Can someone help me out?










share|improve this question































    9















    I have a web server running Ubuntu 17.04 that I am attempting to set up with Apache. Everything ran great until I decided to host two websites on a single machine through virtualHosts. Now apache refuses to start up with even a single host enabled. Each time I attempt to start Apache I get this error:



    apache2: Syntax error on line 80 of /etc/apache2/apache2.conf:
    DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot.


    None of my attempts to fix this have come to anything including:



    apt purge apache2 && rm -r /etc/apache2 


    All line 80 of the error message tells me is DefaultRuntimeDir ${APACHE_RUN_DIR}.



    And at no time do I see where or what APACHE_RUN_DIR is declared as.



    Can someone help me out?










    share|improve this question



























      9












      9








      9


      3






      I have a web server running Ubuntu 17.04 that I am attempting to set up with Apache. Everything ran great until I decided to host two websites on a single machine through virtualHosts. Now apache refuses to start up with even a single host enabled. Each time I attempt to start Apache I get this error:



      apache2: Syntax error on line 80 of /etc/apache2/apache2.conf:
      DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot.


      None of my attempts to fix this have come to anything including:



      apt purge apache2 && rm -r /etc/apache2 


      All line 80 of the error message tells me is DefaultRuntimeDir ${APACHE_RUN_DIR}.



      And at no time do I see where or what APACHE_RUN_DIR is declared as.



      Can someone help me out?










      share|improve this question
















      I have a web server running Ubuntu 17.04 that I am attempting to set up with Apache. Everything ran great until I decided to host two websites on a single machine through virtualHosts. Now apache refuses to start up with even a single host enabled. Each time I attempt to start Apache I get this error:



      apache2: Syntax error on line 80 of /etc/apache2/apache2.conf:
      DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot.


      None of my attempts to fix this have come to anything including:



      apt purge apache2 && rm -r /etc/apache2 


      All line 80 of the error message tells me is DefaultRuntimeDir ${APACHE_RUN_DIR}.



      And at no time do I see where or what APACHE_RUN_DIR is declared as.



      Can someone help me out?







      server apache2 directory






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 20 '17 at 14:55









      Grayson Kent

      1,053414




      1,053414










      asked Jun 20 '17 at 13:29









      timhydtimhyd

      46113




      46113






















          5 Answers
          5






          active

          oldest

          votes


















          6














          Apache2 uses /etc/apache2/envvars to set environment variables. You can use this information to make sure the directory ${APACHE_RUN_DIR} points to is valid.



          I was experiencing the same issue while upgrading from 14.04 to 17.04.
          Problem was: ${APACHE_RUN_DIR} was set to /var/run/apache2, but the apache2 folder was missing in /var/run.



          The fix for me was: mkdir /var/run/apache2






          share|improve this answer





















          • 7





            even if you created the folder or if the folder is already presented (like in my situation) you have to have to run the following command. source /etc/apache2/envvars

            – Peshmerge
            Oct 29 '17 at 23:17











          • you only need to run the envvares command if you are starting Apache without the startscript, if you are using init.d/system.d the file will be sourced automatically.

            – Niyol
            Oct 31 '17 at 10:00











          • @Peshmerge THanks! can you tell me how to retain it after reboot? it seems on reboot we have to manually execute that command everytime

            – T.Todua
            Oct 19 '18 at 16:28



















          6














          The command



          source /etc/apache2/envvars


          sorted my problem out (after trying ALL the others).



          To check whether all is well or not use the command



          apache2 -S


          I found that was quicker than using my DNS records.






          share|improve this answer


























          • I used the source /etc/apache2/envvars but after that my home directory changed from ~ to home and when I wrote cd it showed -bash: cd: HOME not set. When I entered the envvars one of the first lines is # this won't be correct after changing uid and unset HOME. Any idea how to fix this?

            – Mihail Minkov
            Mar 21 at 0:58



















          4














          There is a missing update in "man apache2", at least for option -V;



          Today, one should use either "apachectl" or "apache2ctl" instead of



          "apache2" for at least some options, as stated in



          https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=879571






          share|improve this answer































            0














            in my case it was regarding "Require all denied" line in apache2.conf file which (again) in my case was typed in as just "Require denied"






            share|improve this answer































              0














              Reenebling php5.6 apache module helps to fix this problem.



              Press Ctrl+Alt+T and type these:



              sudo a2dismod php5.6
              sudo a2enmod php5.6


              Then restart apache2 service:



              sudo service apache2 restart





              share|improve this answer










              New contributor




              Vladimir Ch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.





















                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%2f927355%2fubuntu-apache2-defaultruntimedir-must-be-a-valid-directory-absolute-or-relative%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                5 Answers
                5






                active

                oldest

                votes








                5 Answers
                5






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                6














                Apache2 uses /etc/apache2/envvars to set environment variables. You can use this information to make sure the directory ${APACHE_RUN_DIR} points to is valid.



                I was experiencing the same issue while upgrading from 14.04 to 17.04.
                Problem was: ${APACHE_RUN_DIR} was set to /var/run/apache2, but the apache2 folder was missing in /var/run.



                The fix for me was: mkdir /var/run/apache2






                share|improve this answer





















                • 7





                  even if you created the folder or if the folder is already presented (like in my situation) you have to have to run the following command. source /etc/apache2/envvars

                  – Peshmerge
                  Oct 29 '17 at 23:17











                • you only need to run the envvares command if you are starting Apache without the startscript, if you are using init.d/system.d the file will be sourced automatically.

                  – Niyol
                  Oct 31 '17 at 10:00











                • @Peshmerge THanks! can you tell me how to retain it after reboot? it seems on reboot we have to manually execute that command everytime

                  – T.Todua
                  Oct 19 '18 at 16:28
















                6














                Apache2 uses /etc/apache2/envvars to set environment variables. You can use this information to make sure the directory ${APACHE_RUN_DIR} points to is valid.



                I was experiencing the same issue while upgrading from 14.04 to 17.04.
                Problem was: ${APACHE_RUN_DIR} was set to /var/run/apache2, but the apache2 folder was missing in /var/run.



                The fix for me was: mkdir /var/run/apache2






                share|improve this answer





















                • 7





                  even if you created the folder or if the folder is already presented (like in my situation) you have to have to run the following command. source /etc/apache2/envvars

                  – Peshmerge
                  Oct 29 '17 at 23:17











                • you only need to run the envvares command if you are starting Apache without the startscript, if you are using init.d/system.d the file will be sourced automatically.

                  – Niyol
                  Oct 31 '17 at 10:00











                • @Peshmerge THanks! can you tell me how to retain it after reboot? it seems on reboot we have to manually execute that command everytime

                  – T.Todua
                  Oct 19 '18 at 16:28














                6












                6








                6







                Apache2 uses /etc/apache2/envvars to set environment variables. You can use this information to make sure the directory ${APACHE_RUN_DIR} points to is valid.



                I was experiencing the same issue while upgrading from 14.04 to 17.04.
                Problem was: ${APACHE_RUN_DIR} was set to /var/run/apache2, but the apache2 folder was missing in /var/run.



                The fix for me was: mkdir /var/run/apache2






                share|improve this answer















                Apache2 uses /etc/apache2/envvars to set environment variables. You can use this information to make sure the directory ${APACHE_RUN_DIR} points to is valid.



                I was experiencing the same issue while upgrading from 14.04 to 17.04.
                Problem was: ${APACHE_RUN_DIR} was set to /var/run/apache2, but the apache2 folder was missing in /var/run.



                The fix for me was: mkdir /var/run/apache2







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Sep 26 '17 at 11:01









                Yaron

                9,26971941




                9,26971941










                answered Sep 26 '17 at 8:27









                NiyolNiyol

                6112




                6112








                • 7





                  even if you created the folder or if the folder is already presented (like in my situation) you have to have to run the following command. source /etc/apache2/envvars

                  – Peshmerge
                  Oct 29 '17 at 23:17











                • you only need to run the envvares command if you are starting Apache without the startscript, if you are using init.d/system.d the file will be sourced automatically.

                  – Niyol
                  Oct 31 '17 at 10:00











                • @Peshmerge THanks! can you tell me how to retain it after reboot? it seems on reboot we have to manually execute that command everytime

                  – T.Todua
                  Oct 19 '18 at 16:28














                • 7





                  even if you created the folder or if the folder is already presented (like in my situation) you have to have to run the following command. source /etc/apache2/envvars

                  – Peshmerge
                  Oct 29 '17 at 23:17











                • you only need to run the envvares command if you are starting Apache without the startscript, if you are using init.d/system.d the file will be sourced automatically.

                  – Niyol
                  Oct 31 '17 at 10:00











                • @Peshmerge THanks! can you tell me how to retain it after reboot? it seems on reboot we have to manually execute that command everytime

                  – T.Todua
                  Oct 19 '18 at 16:28








                7




                7





                even if you created the folder or if the folder is already presented (like in my situation) you have to have to run the following command. source /etc/apache2/envvars

                – Peshmerge
                Oct 29 '17 at 23:17





                even if you created the folder or if the folder is already presented (like in my situation) you have to have to run the following command. source /etc/apache2/envvars

                – Peshmerge
                Oct 29 '17 at 23:17













                you only need to run the envvares command if you are starting Apache without the startscript, if you are using init.d/system.d the file will be sourced automatically.

                – Niyol
                Oct 31 '17 at 10:00





                you only need to run the envvares command if you are starting Apache without the startscript, if you are using init.d/system.d the file will be sourced automatically.

                – Niyol
                Oct 31 '17 at 10:00













                @Peshmerge THanks! can you tell me how to retain it after reboot? it seems on reboot we have to manually execute that command everytime

                – T.Todua
                Oct 19 '18 at 16:28





                @Peshmerge THanks! can you tell me how to retain it after reboot? it seems on reboot we have to manually execute that command everytime

                – T.Todua
                Oct 19 '18 at 16:28













                6














                The command



                source /etc/apache2/envvars


                sorted my problem out (after trying ALL the others).



                To check whether all is well or not use the command



                apache2 -S


                I found that was quicker than using my DNS records.






                share|improve this answer


























                • I used the source /etc/apache2/envvars but after that my home directory changed from ~ to home and when I wrote cd it showed -bash: cd: HOME not set. When I entered the envvars one of the first lines is # this won't be correct after changing uid and unset HOME. Any idea how to fix this?

                  – Mihail Minkov
                  Mar 21 at 0:58
















                6














                The command



                source /etc/apache2/envvars


                sorted my problem out (after trying ALL the others).



                To check whether all is well or not use the command



                apache2 -S


                I found that was quicker than using my DNS records.






                share|improve this answer


























                • I used the source /etc/apache2/envvars but after that my home directory changed from ~ to home and when I wrote cd it showed -bash: cd: HOME not set. When I entered the envvars one of the first lines is # this won't be correct after changing uid and unset HOME. Any idea how to fix this?

                  – Mihail Minkov
                  Mar 21 at 0:58














                6












                6








                6







                The command



                source /etc/apache2/envvars


                sorted my problem out (after trying ALL the others).



                To check whether all is well or not use the command



                apache2 -S


                I found that was quicker than using my DNS records.






                share|improve this answer















                The command



                source /etc/apache2/envvars


                sorted my problem out (after trying ALL the others).



                To check whether all is well or not use the command



                apache2 -S


                I found that was quicker than using my DNS records.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Oct 10 '18 at 6:30









                Melebius

                5,09352041




                5,09352041










                answered Oct 10 '18 at 4:22









                ianmianm

                6112




                6112













                • I used the source /etc/apache2/envvars but after that my home directory changed from ~ to home and when I wrote cd it showed -bash: cd: HOME not set. When I entered the envvars one of the first lines is # this won't be correct after changing uid and unset HOME. Any idea how to fix this?

                  – Mihail Minkov
                  Mar 21 at 0:58



















                • I used the source /etc/apache2/envvars but after that my home directory changed from ~ to home and when I wrote cd it showed -bash: cd: HOME not set. When I entered the envvars one of the first lines is # this won't be correct after changing uid and unset HOME. Any idea how to fix this?

                  – Mihail Minkov
                  Mar 21 at 0:58

















                I used the source /etc/apache2/envvars but after that my home directory changed from ~ to home and when I wrote cd it showed -bash: cd: HOME not set. When I entered the envvars one of the first lines is # this won't be correct after changing uid and unset HOME. Any idea how to fix this?

                – Mihail Minkov
                Mar 21 at 0:58





                I used the source /etc/apache2/envvars but after that my home directory changed from ~ to home and when I wrote cd it showed -bash: cd: HOME not set. When I entered the envvars one of the first lines is # this won't be correct after changing uid and unset HOME. Any idea how to fix this?

                – Mihail Minkov
                Mar 21 at 0:58











                4














                There is a missing update in "man apache2", at least for option -V;



                Today, one should use either "apachectl" or "apache2ctl" instead of



                "apache2" for at least some options, as stated in



                https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=879571






                share|improve this answer




























                  4














                  There is a missing update in "man apache2", at least for option -V;



                  Today, one should use either "apachectl" or "apache2ctl" instead of



                  "apache2" for at least some options, as stated in



                  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=879571






                  share|improve this answer


























                    4












                    4








                    4







                    There is a missing update in "man apache2", at least for option -V;



                    Today, one should use either "apachectl" or "apache2ctl" instead of



                    "apache2" for at least some options, as stated in



                    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=879571






                    share|improve this answer













                    There is a missing update in "man apache2", at least for option -V;



                    Today, one should use either "apachectl" or "apache2ctl" instead of



                    "apache2" for at least some options, as stated in



                    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=879571







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jun 26 '18 at 5:19









                    RocduferRocdufer

                    412




                    412























                        0














                        in my case it was regarding "Require all denied" line in apache2.conf file which (again) in my case was typed in as just "Require denied"






                        share|improve this answer




























                          0














                          in my case it was regarding "Require all denied" line in apache2.conf file which (again) in my case was typed in as just "Require denied"






                          share|improve this answer


























                            0












                            0








                            0







                            in my case it was regarding "Require all denied" line in apache2.conf file which (again) in my case was typed in as just "Require denied"






                            share|improve this answer













                            in my case it was regarding "Require all denied" line in apache2.conf file which (again) in my case was typed in as just "Require denied"







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Jan 10 at 12:14









                            Гдето ЯкутскийГдето Якутский

                            12




                            12























                                0














                                Reenebling php5.6 apache module helps to fix this problem.



                                Press Ctrl+Alt+T and type these:



                                sudo a2dismod php5.6
                                sudo a2enmod php5.6


                                Then restart apache2 service:



                                sudo service apache2 restart





                                share|improve this answer










                                New contributor




                                Vladimir Ch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                Check out our Code of Conduct.

























                                  0














                                  Reenebling php5.6 apache module helps to fix this problem.



                                  Press Ctrl+Alt+T and type these:



                                  sudo a2dismod php5.6
                                  sudo a2enmod php5.6


                                  Then restart apache2 service:



                                  sudo service apache2 restart





                                  share|improve this answer










                                  New contributor




                                  Vladimir Ch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                  Check out our Code of Conduct.























                                    0












                                    0








                                    0







                                    Reenebling php5.6 apache module helps to fix this problem.



                                    Press Ctrl+Alt+T and type these:



                                    sudo a2dismod php5.6
                                    sudo a2enmod php5.6


                                    Then restart apache2 service:



                                    sudo service apache2 restart





                                    share|improve this answer










                                    New contributor




                                    Vladimir Ch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.










                                    Reenebling php5.6 apache module helps to fix this problem.



                                    Press Ctrl+Alt+T and type these:



                                    sudo a2dismod php5.6
                                    sudo a2enmod php5.6


                                    Then restart apache2 service:



                                    sudo service apache2 restart






                                    share|improve this answer










                                    New contributor




                                    Vladimir Ch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.









                                    share|improve this answer



                                    share|improve this answer








                                    edited 2 days ago









                                    Olimjon

                                    2,316724




                                    2,316724






                                    New contributor




                                    Vladimir Ch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.









                                    answered 2 days ago









                                    Vladimir ChVladimir Ch

                                    1013




                                    1013




                                    New contributor




                                    Vladimir Ch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.





                                    New contributor





                                    Vladimir Ch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.






                                    Vladimir Ch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.






























                                        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%2f927355%2fubuntu-apache2-defaultruntimedir-must-be-a-valid-directory-absolute-or-relative%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

                                        GameSpot

                                        connect to host localhost port 22: Connection refused

                                        Getting a Wifi WPA2 wifi connection