0

I am trying to change the default root directory in Apache webserver but having trouble accessing it from webbrowser.

Disabled SELinux

Stopped IPTables

Trying to make : "/var/www/test/" as default folder

In cd /etc/httpd/conf/httpd.conf : I am making following changes:

292 DocumentRoot "/var/www/test"

302 <Directory /var/www/test>
303     Options FollowSymLinks
304     AllowOverride None
305     Order allow,deny
306     Allow from all
307 </Directory>


317 # This should be changed to whatever you set DocumentRoot to.
318 #
319 <Directory "/var/www/test">

Created folder test under: /var/www/ and gave chmod -R 755 /var/www/test/

Restarted httpd and restarted with no errors.

Here are few instances of logs:

Access Logs:

192.168.1.18 - - [10/Jun/2015:18:27:00 -0500] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
192.168.1.18 - - [10/Jun/2015:18:27:04 -0500] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
192.168.1.18 - - [10/Jun/2015:18:27:40 -0500] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
192.168.1.18 - - [10/Jun/2015:18:27:47 -0500] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; LCJB; rv:11.0) like Gecko"
192.168.1.18 - - [10/Jun/2015:18:27:47 -0500] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; LCJB; rv:11.0) like Gecko"
192.168.1.18 - - [10/Jun/2015:18:31:06 -0500] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
192.168.1.18 - - [10/Jun/2015:18:31:09 -0500] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
192.168.1.18 - - [10/Jun/2015:18:31:27 -0500] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
192.168.1.18 - - [10/Jun/2015:18:45:29 -0500] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
192.168.1.18 - - [10/Jun/2015:19:00:10 -0500] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
192.168.1.18 - - [10/Jun/2015:19:00:12 -0500] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
192.168.1.18 - - [10/Jun/2015:19:00:13 -0500] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
192.168.1.18 - - [10/Jun/2015:19:06:33 -0500] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
192.168.1.18 - - [10/Jun/2015:19:06:37 -0500] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
192.168.1.18 - - [10/Jun/2015:19:26:22 -0500] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"

~

Error Logs:

[Wed Jun 10 18:45:20 2015] [notice] Digest: generating secret for digest authentication ...
[Wed Jun 10 18:45:20 2015] [notice] Digest: done
[Wed Jun 10 18:45:20 2015] [notice] Apache/2.2.15 (Unix) DAV/2 configured -- resuming normal operations
[Wed Jun 10 18:45:25 2015] [notice] caught SIGTERM, shutting down
[Wed Jun 10 18:45:26 2015] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Jun 10 18:45:26 2015] [notice] Digest: generating secret for digest authentication ...
[Wed Jun 10 18:45:26 2015] [notice] Digest: done
[Wed Jun 10 18:45:26 2015] [notice] Apache/2.2.15 (Unix) DAV/2 configured -- resuming normal operations
[Wed Jun 10 18:59:07 2015] [notice] caught SIGTERM, shutting down
[Wed Jun 10 19:00:05 2015] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Jun 10 19:00:05 2015] [notice] Digest: generating secret for digest authentication ...
[Wed Jun 10 19:00:05 2015] [notice] Digest: done
[Wed Jun 10 19:00:05 2015] [notice] Apache/2.2.15 (Unix) DAV/2 configured -- resuming normal operations
[Wed Jun 10 19:00:08 2015] [notice] caught SIGTERM, shutting down
[Wed Jun 10 19:00:09 2015] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Jun 10 19:00:09 2015] [notice] Digest: generating secret for digest authentication ...
[Wed Jun 10 19:00:09 2015] [notice] Digest: done
[Wed Jun 10 19:00:09 2015] [notice] Apache/2.2.15 (Unix) DAV/2 configured -- resuming normal operations
[Wed Jun 10 19:24:44 2015] [notice] caught SIGTERM, shutting down
[Wed Jun 10 19:24:45 2015] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Jun 10 19:24:45 2015] [notice] Digest: generating secret for digest authentication ...
[Wed Jun 10 19:24:45 2015] [notice] Digest: done
[Wed Jun 10 19:24:45 2015] [notice] Apache/2.2.15 (Unix) DAV/2 configured -- resuming normal operations
0

I would like to write this as a comment instead of an answer, but I can't yet so please don't ding me, community.

There is nothing wrong with the pieces you have posted so far. The error logs show the normal notices from restarting apache and the 304 return codes in the access logs you posted are normal as well; they indicate that the resource being requested hasn't changed from what the browser has cached so a retransmit of the document isn't necessary.

I spun up a cloud server and made the changes exactly as you have specified and I get my index.html with the text 'test' from /var/www/test. Making apache the owner of the directory isn't necessary as the world permissions allow reading which is good enough.

So when you say you are having trouble accessing it, what precisely do you see when you try to hit the site? The logs show a private IP which implies you are running apache on the same machine or local network; are you hitting the IP directly?

  • Sorry for troubling everyone. I noticed that I haven't included index.html in the folder. How can I share files and folders by default in this location? – Todd Goodfellow Jun 11 '15 at 5:14
0

You will also need to change the owner of the newly created folder to apache or something, depending on your distribution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.