Apache 2 could not bind, address already in use












4















I installed Apache 2 on Ubuntu 12.10. When I try to start the service using sudo /etc/init.d/apache2 start, I get the following message.



*Starting web server apache2
(98)Address already in use: make_sock: could not bind to address 127.0.0.1:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information. [fail]









share|improve this question




















  • 1





    Make sure apache is not already running when (ps -ef | grep apache). And what does sudo /etc/init.d/apache2 restart say? Verify you have your a site in /etc/apache2/sites-enabled/ and check the files in there.

    – Rinzwind
    Feb 21 '13 at 13:55


















4















I installed Apache 2 on Ubuntu 12.10. When I try to start the service using sudo /etc/init.d/apache2 start, I get the following message.



*Starting web server apache2
(98)Address already in use: make_sock: could not bind to address 127.0.0.1:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information. [fail]









share|improve this question




















  • 1





    Make sure apache is not already running when (ps -ef | grep apache). And what does sudo /etc/init.d/apache2 restart say? Verify you have your a site in /etc/apache2/sites-enabled/ and check the files in there.

    – Rinzwind
    Feb 21 '13 at 13:55
















4












4








4








I installed Apache 2 on Ubuntu 12.10. When I try to start the service using sudo /etc/init.d/apache2 start, I get the following message.



*Starting web server apache2
(98)Address already in use: make_sock: could not bind to address 127.0.0.1:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information. [fail]









share|improve this question
















I installed Apache 2 on Ubuntu 12.10. When I try to start the service using sudo /etc/init.d/apache2 start, I get the following message.



*Starting web server apache2
(98)Address already in use: make_sock: could not bind to address 127.0.0.1:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information. [fail]






apache2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 30 '14 at 0:11









palacsint

1,307109




1,307109










asked Feb 21 '13 at 13:54









PattuPattu

12113




12113








  • 1





    Make sure apache is not already running when (ps -ef | grep apache). And what does sudo /etc/init.d/apache2 restart say? Verify you have your a site in /etc/apache2/sites-enabled/ and check the files in there.

    – Rinzwind
    Feb 21 '13 at 13:55
















  • 1





    Make sure apache is not already running when (ps -ef | grep apache). And what does sudo /etc/init.d/apache2 restart say? Verify you have your a site in /etc/apache2/sites-enabled/ and check the files in there.

    – Rinzwind
    Feb 21 '13 at 13:55










1




1





Make sure apache is not already running when (ps -ef | grep apache). And what does sudo /etc/init.d/apache2 restart say? Verify you have your a site in /etc/apache2/sites-enabled/ and check the files in there.

– Rinzwind
Feb 21 '13 at 13:55







Make sure apache is not already running when (ps -ef | grep apache). And what does sudo /etc/init.d/apache2 restart say? Verify you have your a site in /etc/apache2/sites-enabled/ and check the files in there.

– Rinzwind
Feb 21 '13 at 13:55












5 Answers
5






active

oldest

votes


















2














It's well possible that you have something already running at (or "bound to") that port. Try this command to see processes in question:



sudo lsof -i :80


This lists processes listening on port 80. Once you found the culprit you know which process to kill or kill -9 (also as superuser).



Keep in mind that the Apache instance, assuming you had started that earlier, might have gone "stale" or become a zombie. In the latter case even a reboot may be necessary in some cases.



Otherwise go with the answer from dedunumax.






share|improve this answer































    1














    Try sudo service apache2 start



    then type



    sudo service apache2 status


    second command will display whether it is running or not.






    share|improve this answer































      1














      I got this error message with the following configuration:



      # cat /etc/hosts
      127.0.0.1 localhost
      127.0.0.1 foo
      ...

      # cat /etc/apache2/sites-enabled/foo
      <VirtualHost foo:80>
      ...

      # cat /etc/apache2/ports.conf
      ...
      NameVirtualHost *:80
      Listen localhost:80
      ...


      Changing ports.conf to the following solved the problem:



      NameVirtualHost *:80
      Listen 127.0.0.1:80





      share|improve this answer































        0














        I got this as an apache error message with the following configuration:



        # cat /etc/hosts
        127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
        ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6


        I commented out the ::1 entry and issued an apache restart command.



        # cat /etc/hosts
        127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
        #::1 localhost localhost.localdomain localhost6 localhost6.localdomain6


        # sudo service httpd restart





        share|improve this answer































          0














          Some other software like Nginx might be running and using port 80.



          Apache2 crashed on my VPS with the same message error, and I found that Nginx was present on the server and something (a cron job?) had it started a few days later. This provokes a conflict since it uses port :80 and somehow takes priority over Apache2.



          To check if anything is already using port :80, type:



          netstat -tulpn


          I solved it by uninstalling Nginx (with "remove --purge"), killing the nginx process, and restarting Apache2.






          share|improve this answer























            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%2f259241%2fapache-2-could-not-bind-address-already-in-use%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









            2














            It's well possible that you have something already running at (or "bound to") that port. Try this command to see processes in question:



            sudo lsof -i :80


            This lists processes listening on port 80. Once you found the culprit you know which process to kill or kill -9 (also as superuser).



            Keep in mind that the Apache instance, assuming you had started that earlier, might have gone "stale" or become a zombie. In the latter case even a reboot may be necessary in some cases.



            Otherwise go with the answer from dedunumax.






            share|improve this answer




























              2














              It's well possible that you have something already running at (or "bound to") that port. Try this command to see processes in question:



              sudo lsof -i :80


              This lists processes listening on port 80. Once you found the culprit you know which process to kill or kill -9 (also as superuser).



              Keep in mind that the Apache instance, assuming you had started that earlier, might have gone "stale" or become a zombie. In the latter case even a reboot may be necessary in some cases.



              Otherwise go with the answer from dedunumax.






              share|improve this answer


























                2












                2








                2







                It's well possible that you have something already running at (or "bound to") that port. Try this command to see processes in question:



                sudo lsof -i :80


                This lists processes listening on port 80. Once you found the culprit you know which process to kill or kill -9 (also as superuser).



                Keep in mind that the Apache instance, assuming you had started that earlier, might have gone "stale" or become a zombie. In the latter case even a reboot may be necessary in some cases.



                Otherwise go with the answer from dedunumax.






                share|improve this answer













                It's well possible that you have something already running at (or "bound to") that port. Try this command to see processes in question:



                sudo lsof -i :80


                This lists processes listening on port 80. Once you found the culprit you know which process to kill or kill -9 (also as superuser).



                Keep in mind that the Apache instance, assuming you had started that earlier, might have gone "stale" or become a zombie. In the latter case even a reboot may be necessary in some cases.



                Otherwise go with the answer from dedunumax.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 21 '13 at 14:13









                0xC0000022L0xC0000022L

                3,02353770




                3,02353770

























                    1














                    Try sudo service apache2 start



                    then type



                    sudo service apache2 status


                    second command will display whether it is running or not.






                    share|improve this answer




























                      1














                      Try sudo service apache2 start



                      then type



                      sudo service apache2 status


                      second command will display whether it is running or not.






                      share|improve this answer


























                        1












                        1








                        1







                        Try sudo service apache2 start



                        then type



                        sudo service apache2 status


                        second command will display whether it is running or not.






                        share|improve this answer













                        Try sudo service apache2 start



                        then type



                        sudo service apache2 status


                        second command will display whether it is running or not.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Feb 21 '13 at 13:58









                        dedunumaxdedunumax

                        4,64321627




                        4,64321627























                            1














                            I got this error message with the following configuration:



                            # cat /etc/hosts
                            127.0.0.1 localhost
                            127.0.0.1 foo
                            ...

                            # cat /etc/apache2/sites-enabled/foo
                            <VirtualHost foo:80>
                            ...

                            # cat /etc/apache2/ports.conf
                            ...
                            NameVirtualHost *:80
                            Listen localhost:80
                            ...


                            Changing ports.conf to the following solved the problem:



                            NameVirtualHost *:80
                            Listen 127.0.0.1:80





                            share|improve this answer




























                              1














                              I got this error message with the following configuration:



                              # cat /etc/hosts
                              127.0.0.1 localhost
                              127.0.0.1 foo
                              ...

                              # cat /etc/apache2/sites-enabled/foo
                              <VirtualHost foo:80>
                              ...

                              # cat /etc/apache2/ports.conf
                              ...
                              NameVirtualHost *:80
                              Listen localhost:80
                              ...


                              Changing ports.conf to the following solved the problem:



                              NameVirtualHost *:80
                              Listen 127.0.0.1:80





                              share|improve this answer


























                                1












                                1








                                1







                                I got this error message with the following configuration:



                                # cat /etc/hosts
                                127.0.0.1 localhost
                                127.0.0.1 foo
                                ...

                                # cat /etc/apache2/sites-enabled/foo
                                <VirtualHost foo:80>
                                ...

                                # cat /etc/apache2/ports.conf
                                ...
                                NameVirtualHost *:80
                                Listen localhost:80
                                ...


                                Changing ports.conf to the following solved the problem:



                                NameVirtualHost *:80
                                Listen 127.0.0.1:80





                                share|improve this answer













                                I got this error message with the following configuration:



                                # cat /etc/hosts
                                127.0.0.1 localhost
                                127.0.0.1 foo
                                ...

                                # cat /etc/apache2/sites-enabled/foo
                                <VirtualHost foo:80>
                                ...

                                # cat /etc/apache2/ports.conf
                                ...
                                NameVirtualHost *:80
                                Listen localhost:80
                                ...


                                Changing ports.conf to the following solved the problem:



                                NameVirtualHost *:80
                                Listen 127.0.0.1:80






                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Mar 30 '14 at 0:04









                                palacsintpalacsint

                                1,307109




                                1,307109























                                    0














                                    I got this as an apache error message with the following configuration:



                                    # cat /etc/hosts
                                    127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
                                    ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6


                                    I commented out the ::1 entry and issued an apache restart command.



                                    # cat /etc/hosts
                                    127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
                                    #::1 localhost localhost.localdomain localhost6 localhost6.localdomain6


                                    # sudo service httpd restart





                                    share|improve this answer




























                                      0














                                      I got this as an apache error message with the following configuration:



                                      # cat /etc/hosts
                                      127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
                                      ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6


                                      I commented out the ::1 entry and issued an apache restart command.



                                      # cat /etc/hosts
                                      127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
                                      #::1 localhost localhost.localdomain localhost6 localhost6.localdomain6


                                      # sudo service httpd restart





                                      share|improve this answer


























                                        0












                                        0








                                        0







                                        I got this as an apache error message with the following configuration:



                                        # cat /etc/hosts
                                        127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
                                        ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6


                                        I commented out the ::1 entry and issued an apache restart command.



                                        # cat /etc/hosts
                                        127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
                                        #::1 localhost localhost.localdomain localhost6 localhost6.localdomain6


                                        # sudo service httpd restart





                                        share|improve this answer













                                        I got this as an apache error message with the following configuration:



                                        # cat /etc/hosts
                                        127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
                                        ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6


                                        I commented out the ::1 entry and issued an apache restart command.



                                        # cat /etc/hosts
                                        127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
                                        #::1 localhost localhost.localdomain localhost6 localhost6.localdomain6


                                        # sudo service httpd restart






                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered May 3 '17 at 16:22









                                        gregstergregster

                                        1




                                        1























                                            0














                                            Some other software like Nginx might be running and using port 80.



                                            Apache2 crashed on my VPS with the same message error, and I found that Nginx was present on the server and something (a cron job?) had it started a few days later. This provokes a conflict since it uses port :80 and somehow takes priority over Apache2.



                                            To check if anything is already using port :80, type:



                                            netstat -tulpn


                                            I solved it by uninstalling Nginx (with "remove --purge"), killing the nginx process, and restarting Apache2.






                                            share|improve this answer




























                                              0














                                              Some other software like Nginx might be running and using port 80.



                                              Apache2 crashed on my VPS with the same message error, and I found that Nginx was present on the server and something (a cron job?) had it started a few days later. This provokes a conflict since it uses port :80 and somehow takes priority over Apache2.



                                              To check if anything is already using port :80, type:



                                              netstat -tulpn


                                              I solved it by uninstalling Nginx (with "remove --purge"), killing the nginx process, and restarting Apache2.






                                              share|improve this answer


























                                                0












                                                0








                                                0







                                                Some other software like Nginx might be running and using port 80.



                                                Apache2 crashed on my VPS with the same message error, and I found that Nginx was present on the server and something (a cron job?) had it started a few days later. This provokes a conflict since it uses port :80 and somehow takes priority over Apache2.



                                                To check if anything is already using port :80, type:



                                                netstat -tulpn


                                                I solved it by uninstalling Nginx (with "remove --purge"), killing the nginx process, and restarting Apache2.






                                                share|improve this answer













                                                Some other software like Nginx might be running and using port 80.



                                                Apache2 crashed on my VPS with the same message error, and I found that Nginx was present on the server and something (a cron job?) had it started a few days later. This provokes a conflict since it uses port :80 and somehow takes priority over Apache2.



                                                To check if anything is already using port :80, type:



                                                netstat -tulpn


                                                I solved it by uninstalling Nginx (with "remove --purge"), killing the nginx process, and restarting Apache2.







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Jan 30 at 21:34









                                                Lucius VwLucius Vw

                                                1




                                                1






























                                                    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%2f259241%2fapache-2-could-not-bind-address-already-in-use%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

                                                    How to send String Array data to Server using php in android

                                                    Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                                                    Is anime1.com a legal site for watching anime?