You are not logged in.

#1 2019-11-10 12:15:12

e11i0t
Member
Registered: 2019-02-13
Posts: 7

[SOLVED]Apache web server is not picking files from the right location

Good Evening!
I just installed Apache HTTP Server everything was working as expected but after a while, it stopped picking up the newly created file in "/srv/http" when I visit "localhost". It opens the first file in the browser that created in /srv/http.

What I don't understand is that the DocumentRoot and Directory are looking at "/srv/http" in /etc/httpd/conf/httpd.con file.
The configuration is like:

DocumentRoot "/srv/http"
<Directory "/srv/http">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all  granted
</Directory>

Last edited by e11i0t (2019-11-11 07:13:21)

Offline

#2 2019-11-10 12:47:00

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED]Apache web server is not picking files from the right location

Are you sure that it's not just your browser showing a cached version of the page? Can you force-refresh the page (usually ctrl+F5)?


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2019-11-10 12:49:49

e11i0t
Member
Registered: 2019-02-13
Posts: 7

Re: [SOLVED]Apache web server is not picking files from the right location

I force refreshed it and I even reboot my system. But it still showing a page that doesn't even exist.

Offline

#4 2019-11-10 13:20:11

xse
Member
Registered: 2019-01-08
Posts: 36

Re: [SOLVED]Apache web server is not picking files from the right location

Hey,

I don't know much about apache, but you should be able to have a look in the logs to see which file it tries to access, you might have to set a different loglevel in the configuration.

Here are some resources about apache logging:
- Apache Logging Basics
- The official apache documentation on logs

If that does not work, here is another quick way of seeing which file apache is accessing: you can use strace to have a look at which file your apache process is accessing, i don't have apache on hands so i'll use nginx but the process is the same:

1) i find the PID of the process:

root@potato ~ # ps aux | grep nginx
root      7714  0.0  0.1   7452   668 ?        Ss   08:53   0:00 nginx: master process /usr/bin/nginx -g pid /run/nginx.pid; error_log stderr;
http      7715  0.0  0.6   8672  2636 ?        S    08:53   0:00 nginx: worker process

2) I attach strace to the worker process and i see it accessing the files, along other stuff, it does a lot of stuff, you can make it show you only file access or just save to a file the whole thing and grep/search inside the name of your file:

 root@potato ~ # strace -p 7715
.................
stat64("/srv/http/krkrkrss/index.html", {st_mode=S_IFREG|0644, st_size=2407, ...}) = 0
openat(AT_FDCWD, "/srv/http/krkrkrss/index.html", O_RDONLY|O_NONBLOCK|O_LARGEFILE) = 10
..................

Here is refreshed my page while having strace attached to nginx, and i saw nginx accessing that index page.


Carefully explaining your problem is half the solution.

Offline

#5 2019-11-11 07:12:56

e11i0t
Member
Registered: 2019-02-13
Posts: 7

Re: [SOLVED]Apache web server is not picking files from the right location

It seems like Apache was not properly installed. I reinstalled it and created a separate ~/public_html directory, and now it's working fine!

Offline

Board footer

Powered by FluxBB