Announcement

Collapse
No announcement yet.

Apache2 - http://localhost/ not working

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Apache2 - http://localhost/ not working

    I just installed apache2 and everything went through well with no error message.

    I can start and stop Apache2 no problem.

    In "/etc/apache2/sites-available" I have a file called "default"
    and in "/etc/apache2/sites-enabled" I have a file called "000-default" which is a link of "/etc/apache2/sites-available".

    My Firewall Guarddog is disabled.
    I had Lamp installed before with apache 1.*.* which I remove with #apt-get autoremove apache" and "#apt-get remove --purge apache".
    I have removed the previous php4 and mysql with the same similar command.

    I try to change the filename "000-default" to "default" with no succes.

    The content of "default" is as shown bellow:

    NameVirtualHost *
    <VirtualHost *>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/
    <Directory />
    Options FollowSymLinks
    AllowOverride None
    </Directory>
    <Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
    # This directive allows us to have apache2's default start page
    # in /apache2-default/, but still have / go to the right place
    RedirectMatch ^/$ /apache2-default/
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
    </Directory>

    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined
    ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

    </VirtualHost>

    The problem is that when I go in Firefox and look in "http://localhost/" I get the error message as follow:

    Not Found

    The requested URL / was not found on this server.
    Apache/2.2.4 (Unix) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e PHP/5.2.2 mod_apreq2-20051231/2.5.7 mod_perl/2.0.2 Perl/v5.8.7 Server at localhost Port 80
    Any idea of what could set this straight and make my apache server works?

    I haven't installed php5 and mysql yet but It will be done as soon as apache2 will be kind enough to show:
    It Works!

    #2
    Re: Apache2 - http://localhost/ not working

    Why are you trying to change 000-default to default?
    What does the apache log say when you try to access localhost?

    Comment


      #3
      Re: Apache2 - http://localhost/ not working

      Install Webmin from the repos. I find it helps immensely in administrating many different aspects of your computer, including Apache. I use it all the time.
      For external use only.

      Comment


        #4
        Re: Apache2 - http://localhost/ not working

        My guess is that the URL rewrite in that config file isn't working for some reason (possibly need to enable mod_rewrite in /etc/apache2/mods-enabled?).

        That you're getting that error message shows that Apache is set up OK. Create your website in /var/www/ and have a lot of fun

        Comment


          #5
          Re: Apache2 - http://localhost/ not working

          Originally posted by SheeEttin
          Install Webmin from the repos. I find it helps immensely in administrating many different aspects of your computer, including Apache. I use it all the time.
          Webmin doesn't show up in Adept and I have all the repositories selected.
          sudo apt-get install webmin doesn't work either.

          Comment


            #6
            Re: Apache2 - http://localhost/ not working

            Originally posted by JamesM
            My guess is that the URL rewrite in that config file isn't working for some reason (possibly need to enable mod_rewrite in /etc/apache2/mods-enabled?).

            That you're getting that error message shows that Apache is set up OK. Create your website in /var/www/ and have a lot of fun
            "/etc/apache2/mods-enabled/" is a directory. Which file in it needs to be addressed?

            Comment


              #7
              Re: Apache2 - http://localhost/ not working

              Originally posted by DMurray
              Why are you trying to change 000-default to default?
              What does the apache log say when you try to access localhost?
              Are you talking about the log in "/var/log/apache2/", "error.log"? It's empty and "access.log" too.

              Comment


                #8
                Re: Apache2 - http://localhost/ not working

                Originally posted by Xeor
                Webmin doesn't show up in Adept and I have all the repositories selected.
                sudo apt-get install webmin doesn't work either.
                Huh, then either it's in one of my other repos or it's been removed from the repos. The deb is here, if you want it.

                Anyway, create a file at /var/www/index.html, and you should be good to go. Don't forget to open firewalls or enable port forwarding. (HTTP uses port 80.)
                For external use only.

                Comment


                  #9
                  Re: Apache2 - http://localhost/ not working

                  Originally posted by SheeEttin
                  Originally posted by Xeor
                  Webmin doesn't show up in Adept and I have all the repositories selected.
                  sudo apt-get install webmin doesn't work either.
                  Huh, then either it's in one of my other repos or it's been removed from the repos. The deb is here, if you want it.

                  Anyway, create a file at /var/www/index.html, and you should be good to go. Don't forget to open firewalls or enable port forwarding. (HTTP uses port 80.)
                  Thanks for webmin as it seems to be a very nice tools to look after the settings.


                  But now the error message I get in Firefox is a bit different; it says:

                  Unable to connect













                  Firefox can't establish a connection to the server at localhost.

                  * The site could be temporarily unavailable or too busy. Try again in a few
                  moments.

                  * If you are unable to load any pages, check your computer's network
                  connection.

                  * If your computer or network is protected by a firewall or proxy, make sure
                  that Firefox is permitted to access the Web.
                  I thing I messed up my system a bit when I tried to uninstal lamp.

                  I have a index.html in /var/www

                  Comment


                    #10
                    Re: Apache2 - http://localhost/ not working

                    Merely to rule out the obvious:

                    Code:
                    USER # ps aux | grep -v grep | grep apache
                    root [...] /usr/sbin/apache2 -k start
                    www [...] /usr/sbin/apache2 -k start
                    Code:
                    USER # wget [url]http://127.0.0.1/[/url]
                    [url]http://127.0.0.1/[/url] => `index.html'
                    Connecting to 127.0.0.1:80... connected.
                    HTTP request sent, awaiting response... 302 Found
                    Location: [url]http://127.0.0.1/apache2-default/[/url] [...]

                    Comment


                      #11
                      Re: Apache2 - http://localhost/ not working

                      To be able to use a Rewrite you should have mod-rewrite enabled.

                      There should be a link in mods-enable to a file called rewrite.load in mods-avaliable.

                      Errors in the rewriting module should be wrote to /var/log/apache2/rewrite.log file.

                      And finally, to be able to show a file in /var/www/index.html, you shoul probably comment the rewrite line again.

                      Finally, the rewrite module is one of the most powerful apache features, but it's also one of the hardest to understand, troubleshoot and made the dam thing work as expected. Certainly it's not the place to start learning apache, unless you want to become a lighthttpd fanboy, of course .

                      Hope that it helps.

                      Javier.

                      Comment

                      Working...
                      X