Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Can't access web pages on apache2 web server

  1. #1
    Join Date
    Aug 2007
    Location
    Colorado
    Beans
    34
    Distro
    Ubuntu 13.10 Saucy Salamander

    Can't access web pages on apache2 web server

    I can't access any web page that is on my ubuntu 13.10 server, I get the error
    Not Found

    The requested URL /rentals was not found on this server.
    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


    I have checked my router port forwarding and that is correct, I even deleted the port settings and recreated them, this didn't work, I even uninstalled apache2 and reinstalled it, this didn't work. I can access the pages if I use the internal IP address of 192.168.x.x but if I use the one that I have through DYNDNS then it doesn't work. I have made sure my external IP is correct with DYNDNS and I have even tried to access the pages using my external IP/webpage and that doesn't work. What else can I do to allow me to get to my web pages using my www.registered name.com again. This did work, I am wondering if a update or upgrade broke something.

    any help please.

  2. #2
    Join Date
    Sep 2013
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Can't access web pages on apache2 web server

    Have you created the virtual website with apache and enabled it?

    EDIT: Sorry, I re-read what you have posted and you wouldn't be able to access it if it wasn't enabled lol. Anyway, will you post the output of:
    Code:
    cat /etc/apache2/sites-enabled/<yoursite>
    Thanks
    Last edited by tfrue; March 12th, 2014 at 06:50 AM.
    "Ignorance is short-lived, and knowledge is forever."


  3. #3
    Join Date
    Aug 2007
    Location
    Colorado
    Beans
    34
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Can't access web pages on apache2 web server

    the /etc/apache2/sites-enabled/ directory is empty, is there something that needs to be in that directory, or is there a configuration script that can be run to set things up correctly seeing as I deleted apache2 and reinstalled it.

  4. #4
    Join Date
    Sep 2013
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Can't access web pages on apache2 web server

    Here is a link to the Ubuntu 13.10 server guide that does a good job explaining Apache2:
    https://help.ubuntu.com/13.10/serverguide/httpd.html

    Here is link from the Apache2 website on virtual host configurations:
    http://httpd.apache.org/docs/2.2/vhosts/

    Here are virtual host examples:
    http://httpd.apache.org/docs/2.2/vhosts/examples.html

    If you can't make sense of this, since it's a bit overwhelming, I will go over a basic set up. I would also like to point out that you will not be able to copy /etc/apache2/sites-available/default, the file is actually named "000-default.conf" so you would actually type: cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mynewsite.conf

    This is what the "000-default.conf" file looks like:
    Code:
    chris@ubuntu:~$ cat /etc/apache2/sites-available/000-default.conf 
    <VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com
    
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www
    
        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    
        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
    </VirtualHost>
    You need to make "#ServerName www.example.com" look like -> ServerName <DYNDNS FQDN>. So basically delete the "#" and replace "example.com" with your DYNDNS FQDN.(Fully Qualified Domain Name)

    You can edit the DocumentRoot and ServerAdmin options, but you don't have to; the only thing to note is that you will need to put your web files in the /var/www/ directory.

    Just a tid bit of information, if you would like a certain html file open when someone tries to go to your site, meaning when someone types your FQDN in the address bar, you need to edit the /etc/apache2/mods-available/dir.conf file.

    Here is what it looks like:
    Code:
    <IfModule mod_dir.c>
        DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
    </IfModule>
    So let's say that you want to serve /var/www/main.html as the file that will be your main page, you would insert "main.html" infrot of "index.html". So the "dir.conf" file would look like:
    Code:
    <IfModule mod_dir.c>
        DirectoryIndex main.html index.html index.cgi index.pl index.php index.xhtml index.htm
    </IfModule>
    Chris
    "Ignorance is short-lived, and knowledge is forever."


  5. #5
    Join Date
    Sep 2013
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Can't access web pages on apache2 web server

    After you do all this, you need to enable the new virtual host configuration and reload the web server, so type:
    Code:
    sudo a2ensite mynewsite.conf
    sudo service apache2 reload
    sudo service apache2 restart
    You may not have to do the restart command, but it never hurts.

    Chris
    "Ignorance is short-lived, and knowledge is forever."


  6. #6
    Join Date
    Aug 2007
    Location
    Colorado
    Beans
    34
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Can't access web pages on apache2 web server

    Thank you for your help on this tfure, I have done the steps you said starting with the cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mynewsite.conf and also editing that one line for the server name and I am still getting the same error. Is there something else I can do to fix my problem.

  7. #7
    Join Date
    Sep 2013
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Can't access web pages on apache2 web server

    Were you able to successfully run the "sudo a2ensite mynewsite.conf?

    Will you post the output of (You can copy and paste into a terminal):
    Code:
    ls -ll /etc/apache2/sites-available/;ls -ll /etc/apache2/sites-enabled/;cat /etc/apache2/sites-enabled/*.conf;a2query -s
    What this will do is execute four different commands. First being a long listing ( ls -ll ) of the sites-available directory, the second is the same but of the /sites-enabled/ directory, the third will "cat" the contents of any file in the /sites-enabled/ directory that has ".conf", and the last will query apache2 for the sites that are enabled.

    Chris
    "Ignorance is short-lived, and knowledge is forever."


  8. #8
    Join Date
    Aug 2007
    Location
    Colorado
    Beans
    34
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Can't access web pages on apache2 web server

    Here is what it says, I did give up on this and formatted the server and reinstalled ubuntu and I am still getting the same error. Is there any way I can check the steps that requests are going like if I were to type in my doman name.com and watch where it goes from my system back to my web server and where it goes from there, am I having some strange issue with my router, or what, if I type in the local IP address for that system the default web page does come up so the apache web server is working to a point, but where is that error coming up or why


    Code:
    total 12
    -rw-r--r-- 1 root root 1327 Jul 24  2013 000-default.conf
    -rw-r--r-- 1 root root 6432 Jul 20  2013 default-ssl.conf
    total 0
    lrwxrwxrwx 1 root root 35 Mar 12 22:22 000-default.conf -> ../sites-available/000-default.conf
    <VirtualHost *:80>
            # The ServerName directive sets the request scheme, hostname and port that
            # the server uses to identify itself. This is used when creating
            # redirection URLs. In the context of virtual hosts, the ServerName
            # specifies what hostname must appear in the request's Host: header to
            # match this virtual host. For the default virtual host (this file) this
            # value is not decisive as it is used as a last resort host regardless.
            # However, you must set it for any further virtual host explicitly.
            #ServerName www.example.com
    
            ServerAdmin webmaster@localhost
            DocumentRoot /var/www
    
            # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
            # error, crit, alert, emerg.
            # It is also possible to configure the loglevel for particular
            # modules, e.g.
            #LogLevel info ssl:warn
    
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    
            # For most configuration files from conf-available/, which are
            # enabled or disabled at a global level, it is possible to
            # include a line for only one particular virtual host. For example the
            # following line enables the CGI configuration for this host only
            # after it has been globally disabled with "a2disconf".
            #Include conf-available/serve-cgi-bin.conf
    </VirtualHost>
    
    # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
    000-default (enabled by site administrator)

  9. #9
    Join Date
    Mar 2014
    Beans
    50

    Re: Can't access web pages on apache2 web server

    Which version of UBuntu are you running? I recently downloaded & installed Ubuntu 12.04 and it did not include Apache. Try
    Code:
    sudo apt-get install apache2
    . Your webpage mountpoint is at /var/www. Once you download it, test it by typing 127.0.0.1 as the url in your browser. Then test for localhost configuration by using "localhost' as the url. If apache is enabled, you'll get the mesg "It Works!".

  10. #10
    Join Date
    Aug 2007
    Location
    Colorado
    Beans
    34
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Can't access web pages on apache2 web server

    I downloaded the latest version of server 13.10. If I type in the local IP 192.168.x.x the "It Works" does show up. but not if I go to www.my_domain_name.com I get the original error message it does add a /UI at the end, not sure why if I use the domain name not if I type in the local IP address

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •