the requested url was not found on this server

Issues related to applications and software problems
Post Reply
countomc
Posts: 1
Joined: 2018/03/31 18:24:56

the requested url was not found on this server

Post by countomc » 2018/03/31 18:45:51

I know this topic has gone around before but I have tried nearly everything posted and none seem to fix my problem.

I have a webserver (CentOS 7) with several vhosts defined. I have a vhost set up for Joomla training, 'www.joomtst.tst' on a server with IP 192.168.1.21. When I attempt to access this via 192.168.1.21/www.joomtst.tst (from another computer, a laptop) I get the url not found message. Checking the access_log shows that the request returned a 404 error. However, when I make any entry in the 'hosts' file of the laptop used to access the test website it works just fine. Just to verify I created another vhost site and have the same issue. Adding that URL to the "hosts' files on the other computers used to access the test URL's solves the problem for the new site. I have the same issue with phpMyAdmin on the webserver, 192.168.1.21/phpMyAdmin returns a 404 error.

I have spent a week trying every fix I can find in the forums with no success. Disabling SELinux makes no difference.

Any ideas?

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: the requested url was not found on this server

Post by TrevorH » 2018/03/31 20:31:50

If you aim to use name based virtual hosts then your clients need to address the server by name - e.g if you have an httpd server on 192.168.1.1 that is serving content for a.company.com and b.company.com then if you point your web browser to http://192.168.1.1/ then you will get whatever the default vhost is on the server. If you make a hosts file entry on the client for "192.168.1.1 b.company.com" then point your browser at http://b.company.com/ then the server on 192.168.1.1 will be told by the browser that it wants to use the vhost for b.company.com and it will serve content for that vhost. If you set up hosts to point 192.168.1.1 a.company.com then it will serve you the content for the a.company.com vhost. If you set up hosts to point 192.168.1.1 to c.company.com and there is no vhost for that on the server then it will serve you the content for whatever the default vhost is.

It's just the way it works.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

MartinR
Posts: 714
Joined: 2015/05/11 07:53:27
Location: UK

Re: the requested url was not found on this server

Post by MartinR » 2018/04/04 13:12:28

You can use alternative names for a particular service, but I've not tried with literal IP addresses. The tail end of my http.conf for one machine looks like:

Code: Select all

<VirtualHost *:80>
    ServerName XXXXXXX.XXX.XXXX.XXXXXXXXXXX.XXX
    ServerAlias XXXXXXX.cluster
    ServerAlias XXXXXXX
    DocumentRoot "/srv/www/html"
</VirtualHost>
<VirtualHost *:80>
    ServerName inst.XXX.XXXX.XXXXXXXXXXX.XXX
    ServerAlias inst.cluster
    ServerAlias inst
    DocumentRoot "/srv/www/inst"
    Options Indexes FollowSymLinks Includes
</VirtualHost>
<VirtualHost *:80>
    ServerName wiki.XXX.XXXX.XXXXXXXXXXX.XXX
    ServerAlias wiki.cluster
    ServerAlias wiki
    DocumentRoot "/srv/www/dokuwiki"
</VirtualHost>
The ServerName lines refer to the public facing FQDN, the .cluster lines are an internal network, and the simple names are a bit of a catchall. Try setting your system up something like:

Code: Select all

<VirtualHost *:80>
    ServerName 'www.joomtst.tst
    ServerAlias 192.168.1.21
    ...
WARNING - I've not tried this name/IP combination, it is only a suggestion.

mervgh
Posts: 5
Joined: 2015/08/15 21:50:51

Re: the requested url was not found on this server

Post by mervgh » 2018/04/04 15:19:26

<VirtualHost *:80>
ServerName 'www.joomtst.tst
ServerAlias 192.168.1.21
...


No need to use an ip address .... you just need to update your dns server with an A record for the url / ip address

MartinR
Posts: 714
Joined: 2015/05/11 07:53:27
Location: UK

Re: the requested url was not found on this server

Post by MartinR » 2018/04/04 17:07:03

@mervgh - I think the OP has that covered since he can access the machine using the FQDN. (BTW, it's not clear if the name is an alias, in which case it would be the CNAME, not A RR that needed checking.) The problem in this case though is that the browser notices a difference and it doesn't use DNS to change the string. See Trevor's explanation.

Post Reply