I am following a book's chapter on setting up Virtual Hosts. The process is:

1.create a file /etc/httpd/conf.d/example.com.conf 2.set its content to

<VirtualHost *:80>
    ServerName www.example.com
    ServerAlias example.com
    DocumentRoot    /var/www/html/example/

And finally

3.execute apachectl configtest and apachectl graceful

This appears to be working. But more commonly, DocumentRoot is located in /home/exampleuser/public_html. This path is problematic to apache group so I modified permissions to

drwxr-x--- 3 exampleuser apache 4096 Feb  8 09:50 exampleuser
drwxr-xr-x 2 exampleuser apache 4096 Feb  8 09:55 public_html

where exampleuser is the user that to which the the directory belongs and was created with useradd exampleuser command.

I also added this code in /etc/httpd/conf/httpd.conf and reloaded httpd.service.

<Directory “/home/exampleuser/public_html”>
      Options Indexes FollowSymLinks
      AllowOverride None
      Require all granted

The book doesn't state what is the correct permission configuration so I am wondering if I have done it correctly? Is there a security issue if I leave the permissions as they are now?

httpd error_log file

[Wed Feb 08 10:25:55.453239 2017] [mpm_prefork:notice] [pid 4848] AH00171: Graceful restart requested, doing restart
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using example.com. Set the 'ServerName' directive globally to suppress this message
[Wed Feb 08 10:25:55.732490 2017] [auth_digest:notice] [pid 4848] AH01757: generating secret for digest authentication ...
[Wed Feb 08 10:25:55.733391 2017] [lbmethod_heartbeat:notice] [pid 4848] AH02282: No slotmem from mod_heartmonitor
[Wed Feb 08 10:25:55.736501 2017] [:warn] [pid 4848] NSSSessionCacheTimeout is deprecated. Ignoring.
[Wed Feb 08 10:25:55.745349 2017] [mpm_prefork:notice] [pid 4848] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips mod_auth_kerb/5.4 mod_fcgid/2.3.9 mod_nss/1.0.14 NSS/3.21 Basic ECC configured -- resuming normal operations
[Wed Feb 08 10:25:55.745375 2017] [core:notice] [pid 4848] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

What's quotes in config?

<Directory “/home/exampleuser/public_html”>


<Directory "/home/exampleuser/public_html">

And see log into /var/log.

  • nice catch. I edited it, but I think it didn't change anything. I successfully loaded index.html in public_html before and after changing it. I updated question with error_log file
    – sanjihan
    Feb 8 '17 at 10:29

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.