+ Post New Thread
Results 1 to 14 of 14
*nix Thread, Ubuntu Apache newbie in Technical; Hi, I have bought a new machine and installed the latest version of Ubuntu on it. I've installed Apache2, as ...
  1. #1
    rocknrollstar's Avatar
    Join Date
    Jun 2008
    Location
    Hampshire
    Posts
    435
    Thank Post
    387
    Thanked 28 Times in 24 Posts
    Rep Power
    21

    Ubuntu Apache newbie

    Hi, I have bought a new machine and installed the latest version of Ubuntu on it. I've installed Apache2, as I want to run a few web apps on it.

    The problem is that only http://localhost/ will work to get to the root webpage via a web browser. http://servername/ or http://ipaddress/ will not- they simply give a 404 error (from the orginal machine or a networked machine).

    I know a few bits about unix, but mostly google stuff off the net. Can't solve this one though!

    It's got DHCP, getting an IP off a windows server. It can ping the network fine, and access the web and shared resources.

    Any ideas? Thanks.

  2. #2

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,821
    Thank Post
    272
    Thanked 1,140 Times in 1,036 Posts
    Rep Power
    351
    Quote Originally Posted by rocknrollstar View Post
    Hi, I have bought a new machine and installed the latest version of Ubuntu on it. I've installed Apache2, as I want to run a few web apps on it.

    The problem is that only http://localhost/ will work to get to the root webpage via a web browser. http://servername/ or http://ipaddress/ will not- they simply give a 404 error (from the orginal machine or a networked machine).

    I know a few bits about unix, but mostly google stuff off the net. Can't solve this one though!

    It's got DHCP, getting an IP off a windows server. It can ping the network fine, and access the web and shared resources.

    Any ideas? Thanks.
    I assume you have changed the path for the directory away from the default /var/www?

    If you have then you need to chmod the directory you have changed it to, for example chmod 777 /home/folder

  3. Thanks to glennda from:

    rocknrollstar (21st May 2010)

  4. #3
    rocknrollstar's Avatar
    Join Date
    Jun 2008
    Location
    Hampshire
    Posts
    435
    Thank Post
    387
    Thanked 28 Times in 24 Posts
    Rep Power
    21
    Quote Originally Posted by glennda View Post
    I assume you have changed the path for the directory away from the default /var/www?

    If you have then you need to chmod the directory you have changed it to, for example chmod 777 /home/folder
    No, I've not changed that (not sure how). It definitely loads var/www/ as I slightly changed the index page, which is reflected by the browser.

  5. #4
    painejake's Avatar
    Join Date
    Jan 2009
    Location
    Birmingham
    Posts
    100
    Thank Post
    38
    Thanked 8 Times in 8 Posts
    Rep Power
    14
    Wouldn't give a 404 anyway would be 403

    Can you post the contents of /etc/apache2/sites-enabled/default here. We might be able to help more if we can see the configuration of the host.
    Last edited by painejake; 21st May 2010 at 11:14 AM.

  6. Thanks to painejake from:

    rocknrollstar (21st May 2010)

  7. #5

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,867
    Thank Post
    412
    Thanked 778 Times in 651 Posts
    Rep Power
    182
    Quote Originally Posted by glennda View Post
    If you have then you need to chmod the directory you have changed it to, for example chmod 777 /home/folder
    NOOOOO. Under absolutely no circumstances ever should you do this. It is a massive, gaping security problem.

    Instead, you should (for the default packages of Apache2) chgrp www-data /home/folder. Or even better, place a symlink to /home/folder in /var/www.

  8. #6

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,821
    Thank Post
    272
    Thanked 1,140 Times in 1,036 Posts
    Rep Power
    351
    Quote Originally Posted by powdarrmonkey View Post
    NOOOOO. Under absolutely no circumstances ever should you do this. It is a massive, gaping security problem.

    Instead, you should (for the default packages of Apache2) chgrp www-data /home/folder. Or even better, place a symlink to /home/folder in /var/www.
    I didn't know the exact chmod command off the top of my head, hence why it was an example - maybe i should have not used a read/write command for my example!

  9. Thanks to glennda from:

    rocknrollstar (21st May 2010)

  10. #7
    rocknrollstar's Avatar
    Join Date
    Jun 2008
    Location
    Hampshire
    Posts
    435
    Thank Post
    387
    Thanked 28 Times in 24 Posts
    Rep Power
    21
    Quote Originally Posted by painejake View Post
    Wouldn't give a 404 anyway would be 403

    Can you post the contents of /etc/apache2/sites-enabled/default here. We might be able to help more if we can see the configuration of the host.
    <VirtualHost *:80>
    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
    </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

    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>

  11. #8
    painejake's Avatar
    Join Date
    Jan 2009
    Location
    Birmingham
    Posts
    100
    Thank Post
    38
    Thanked 8 Times in 8 Posts
    Rep Power
    14
    Seems fine. Do you have any IPTables setup that could stop the connection remotely? You can view these rules with: sudo iptables -L

    Can you access it via the server IP from the Ubuntu machine?
    Last edited by painejake; 21st May 2010 at 11:14 AM.

  12. Thanks to painejake from:

    rocknrollstar (21st May 2010)

  13. #9
    rocknrollstar's Avatar
    Join Date
    Jun 2008
    Location
    Hampshire
    Posts
    435
    Thank Post
    387
    Thanked 28 Times in 24 Posts
    Rep Power
    21
    Quote Originally Posted by painejake View Post
    Seems fine. Do you have any IPTables setup that could stop the connection remotely? You can view these rules with: sudo iptables -L
    administrator@mtube:~$ sudo iptables -L
    [sudo] password for administrator:
    Chain INPUT (policy ACCEPT)
    target prot opt source destination

    Chain FORWARD (policy ACCEPT)
    target prot opt source destination

    Chain OUTPUT (policy ACCEPT)
    target prot opt source destination



    ---------------------------------------------------------------------------------------
    Traceroute
    Hop Hostname IP Time 1 Time 2
    1 mtube.local 10.199.224.187 0.103ms
    1 10.199.224.16 10.199.224.16 0.351ms
    1 10.199.224.16 10.199.224.16 0.371ms


    ---------------------------------------------------------------------------------------
    Ping the windows server (10.199.224.16)

    Bytes Source Seq Time Units
    64 10.199.224.16 1 0.083 ms
    64 10.199.224.16 2 0.122 ms
    64 10.199.224.16 3 0.124 ms
    64 10.199.224.16 4 0.122 ms
    64 10.199.224.16 5 0.117 ms
    Time minimum: 0.08 ms
    Time average: 0.11 ms
    Time maximum: 0.12 ms
    Packets transmitted: 5
    Packets received: 5
    Successful packets: 100%

    ---------------------------------------------------------------------------------------

    Note that I can ping from a windows machine to the ubuntu machine fine. I can also type in http://10.199.224.187 from a windows machine and it shows up the 'It Works" webpage fine. It's only http://mtube/ that doesn't work from any machine, inc the ubuntu machine.

  14. #10
    painejake's Avatar
    Join Date
    Jan 2009
    Location
    Birmingham
    Posts
    100
    Thank Post
    38
    Thanked 8 Times in 8 Posts
    Rep Power
    14
    Oh. Have you setup the DNS settings for mtube in the console on the Windows domain?

  15. Thanks to painejake from:

    rocknrollstar (21st May 2010)

  16. #11
    greenfieldsupport's Avatar
    Join Date
    Mar 2007
    Location
    Newton Aycliffe, Durham
    Posts
    240
    Thank Post
    14
    Thanked 3 Times in 3 Posts
    Rep Power
    16
    Yeah, you need to add an A record for your server in your DNS Namespace..

    If your using a microsoft DNS Server, open the dns management, click Forward lookup zones > open your site (school.local) right click and click New Host (A)

    Type in your hostname mtube
    then type in the ipaddress in the box 10.199.224.187

    click okay

    now from any windows machine type http://mtube ... Depending on your DNS setup you may need the FQDN ( http://mtube.school.local )

  17. Thanks to greenfieldsupport from:

    rocknrollstar (21st May 2010)

  18. #12

    Join Date
    Dec 2009
    Location
    London
    Posts
    42
    Thank Post
    4
    Thanked 10 Times in 7 Posts
    Rep Power
    12
    I would recommend assigning the NIC a static address. this can be done in /etc/networks/interfaces

    Personally I would futureproof it and assume you're going to have more than one site on the box. Yoe need to tinker with the /etc/apache2/sites-enabled/000-default file, here's an example:

    <VirtualHost *:80>
    ServerName www.website1.co.uk
    DocumentRoot /var/www/website1
    </VirtualHost>

    <VirtualHost *:80>
    ServerName www.website2.co.uk
    DocumentRoot /var/www/website2
    </VirtualHost>

    the ServerName variable is also known as the host header. This means that visitors can only access that site with that url in their address bar

  19. Thanks to prad from:

    rocknrollstar (21st May 2010)

  20. #13
    rocknrollstar's Avatar
    Join Date
    Jun 2008
    Location
    Hampshire
    Posts
    435
    Thank Post
    387
    Thanked 28 Times in 24 Posts
    Rep Power
    21
    Quote Originally Posted by greenfieldsupport View Post
    Yeah, you need to add an A record for your server in your DNS Namespace..

    If your using a microsoft DNS Server, open the dns management, click Forward lookup zones > open your site (school.local) right click and click New Host (A)

    Type in your hostname mtube
    then type in the ipaddress in the box 10.199.224.187

    click okay

    now from any windows machine type http://mtube ... Depending on your DNS setup you may need the FQDN ( http://mtube.school.local )
    OK, well http://mtube can be accessed from a windows machine, but not from ubuntu itself (the host machine). Any ideas?

  21. #14
    painejake's Avatar
    Join Date
    Jan 2009
    Location
    Birmingham
    Posts
    100
    Thank Post
    38
    Thanked 8 Times in 8 Posts
    Rep Power
    14
    Added the proxy exception in firefox?



SHARE:
+ Post New Thread

Similar Threads

  1. Hi from newbie
    By matthewk1971 in forum General Chat
    Replies: 5
    Last Post: 13th August 2009, 02:37 PM
  2. Newbie
    By Seal-Tech in forum Virtual Learning Platforms
    Replies: 3
    Last Post: 18th June 2009, 06:16 PM
  3. [Ubuntu] Locking down Ubuntu for a newbie
    By rolfea in forum *nix
    Replies: 7
    Last Post: 12th May 2009, 01:19 PM
  4. Replies: 9
    Last Post: 25th March 2008, 07:13 PM
  5. Hello, newbie here
    By angelsea in forum General Chat
    Replies: 1
    Last Post: 27th March 2007, 06:39 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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