Jump to content

Recommended Posts

Posted

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.

Posted
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

  • Thanks 1
Posted
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.

Posted (edited)

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.

Edited by painejake
  • Thanks 1
Posted

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.

Posted
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!

  • Thanks 1
Posted
Wouldn't give a 404 anyway would be 403 :p

 

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.

 

ServerAdmin webmaster@localhost

 

DocumentRoot /var/www

Options FollowSymLinks

AllowOverride None

Options Indexes FollowSymLinks MultiViews

AllowOverride None

Order allow,deny

allow from all

 

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None

Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch

Order allow,deny

Allow from all

 

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/"

Options Indexes MultiViews FollowSymLinks

AllowOverride None

Order deny,allow

Deny from all

Allow from 127.0.0.0/255.0.0.0 ::1/128

 

Posted (edited)

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?

Edited by painejake
  • Thanks 1
Posted
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.

Posted

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 )

  • Thanks 1
Posted

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:

 

ServerName http://www.website1.co.uk

DocumentRoot /var/www/website1

 

ServerName http://www.website2.co.uk

DocumentRoot /var/www/website2

 

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

  • Thanks 1
Posted
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?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...