LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   apache Redirects Subdirectory http request to 10.5.7.76 - Why?? (https://www.linuxquestions.org/questions/linux-server-73/apache-redirects-subdirectory-http-request-to-10-5-7-76-why-4175620718/)

6th_sense 01-02-2018 08:09 AM

apache Redirects Subdirectory http request to 10.5.7.76 - Why??
 
Problem (Described Chronologically) - New findings near bottom:

Install:

I installed the Apache webserver on Centos 7 some time back on a private network - internal to my office. The IP address of the server was 10.5.7.76 - handed out by DHCP - so I set the httpd.conf file to listen to 10.5.7.76:80, and the server name to the same.

Moved Server URL - Works fine:

I then moved my server to a properly configured DNS location. Say example.com and I have files on example.com/ that work just fine - ie index.html and lots of pages that load just fine. I changed the httpd.conf file so that the server listens to 192.16...100:80, as it is again on a private internal network with the firewall redirecting http requests to the server.

Restarted Apache:

I restarted apache using systemctl restart httpd.service.

Created Subdirectory - broken:

I created a subdirectory to my webserver's root directory called home - I tried putting an index.html file in here and tried to load it in the web browser. (no .htaccess files being used).

The web browser is constantly redirected to http://10.5.7.76/home/ instead. I don't understand why. There is *NO* reference to 10.5.7.76 in any of /etc/httpd/* (grep -r "10\.5\.7" - except in the previous logs).



Let me know what you think might solve this problem.

I am not sure what to try any more.... I can't see this as being anything aside from an Apache issue - I don't see this as being a DNS resolution issue - I can already load webpages from my server.

I don't see this as being an SELinux issue - I don't believe permissions are involved - "apachectl configtest", doesn't seem to complain of any problems. I've set SELinux to allow requests from the /home directory - I had this part of the directories relegated to wordpress (which I subsequently deleted to see what the issue with this directory was) - and I had set policies to allow use for httpd content - but again, the webserver doesn't complain of access issues - it just seems to resolve the host to 10.5.7.76

As far as firewall issues are concerned I've set the appropriate permissions in IPtables to allow for port 80 to listen to incoming requests - which is what allows the webserver to run.


Can you Give me a Better Description/Search Terms?:

If you can think of a better description or better search terms for the issue I face on google etc... even that would be of great help.


Continued Investigation Shows:

It looks like this *may* be a Mozilla/Firefox browser issue - I tried using Chrome and Konqueror browsers and they just show the contents of the directory in question - as opposed to being redirected - something is potentially wrong with the browser and I need to change Apache to allow for serving the index.html or index.php pages...

MensaWater 01-02-2018 09:25 AM

Do you have the hostname in /etc/hosts file assigned to that IP rather than 127.0.0.1? Generally I like to leave localhost on 127.0.0.1 as first line in hosts file then add the hostname itself (with short name and FQDN aliases) as the next line pointing the server's primary IP.

Did you add the hostname /etc/sysconfig/network

6th_sense 01-02-2018 09:33 AM

Partially Solved Issue:

I cleared the cache on my firefox browser and that sent the problem away! I didn't know it would do that though!?!!

I now only see a directory listing - need to add something to the Apache server to indicate that it is to serve webpages from here now.



MensaWater:

Hi MensaWater,

Thank you for responding. I haven't looked at the hosts file. My further investigations show that that is not the issue at the moment any how.

6th_sense 01-02-2018 10:24 AM

Hi guys,

Thank you for all the attention - I managed to solve all the problems I faced. I even re-installed wordpress and managed to get it going properly.

Regards,

- 6th -


All times are GMT -5. The time now is 10:53 PM.