OLS + CentOS 7.5 gives persistent 404 error on new virtual host

#1
I've been scratching my head a while trying to set up OLS on Centos 7.

I've installed Centos + OLS 1.4.44.
I ran simply did a 'systemctl start lsws' + 'systemctl enable lsws' after installation, and I've established that:
- The admin interface is working (122.133.122.133:7080)
- The virual host "Example" is working (122.133.122.133)

I have made a new Virtual Host for domain.com - but it returns 404 error no matter what I've tried so far.
1. I've added a user "peter" ('adduser peter') with homedir of /home/peter
2. Logged in as "peter" I have created a directory /home/peter/public_html (0775) + /home/peter/logs (0775)
3. I've made a index.html (0664) in /home/peter/public_html/ cointaining "Hello World" and nothing else

4. I've set up a Virtual Host in Openlitespeed admin interface as follow:
Virtual Host Name - domain.com
Virtual Host Root - /home/peter/
Config File - $SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf
Follow Symbolic Link - Yes
Enable Scripts - Yes
Restrained - Yes
External App Set UID Mode - Server UID
suEXEC User - Not set
suEXEC Group - Not set
Document Root - $VH_ROOT/public_html/
Domain Name - domain.com
Enable Compression - Yes
Use Server Index Files - No
Index Files - index.html
Auto Index - Not set
Auto Index URI - /_autoindex/default.php

I've also set up logs to be on DEBUG to $VH_ROOT/logs/error.log and access logs to $VH_ROOT/logs/access.log.

5. In Virtual Host Mappings I've added a new mapping for domain.com. I've also set "Example" to domain 122.133.122.133 (instead of *).
6. I've done a graceful/restart of OLS.

I am getting 404 error when visiting domain.com.

My first thoughts are that this has something to do with file permissions - but I am not sure.

- I have turned off SELinux
- I have tried adding public_html to group nobody
- I have tried ridicolous permissions like 777 on file and directories
- I have tried different "External App Set UID Mode" and even suEXEC user/group set to 'peter'

In the access logs (/home/peter/logs/access.log) I am getting when trying to open domain.com. I notice that the log file is owned by nobody:nobody.
111.111.111.111 - - [27/Feb/2019:15:10:43 +0000] "GET / HTTP/1.1" 404 655 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0"
111.111.111.111 - - [27/Feb/2019:15:10:43 +0000] "GET / HTTP/1.1" 404 655 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0"
111.111.111.111 - - [27/Feb/2019:15:10:44 +0000] "GET / HTTP/1.1" 404 655 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0"

For testing purposes I fired up a "VPS with Ubuntu + OLS + WordPress". Made the exact same configuration to user, directories, index.html, virtual host and listener - and it's working without problems.

What am I doing wrong? Anyone had similar issues?

Thank you.
 
#2
I've played around with file ownership to /home/peter/public_html and managed to progress a bit.

Setting owner of /home/peter (and public_html subdir) to nobody:user does work and the 404 error is gone. This however, is not optimal - and probably not secure at all.

Setting virtual host root to $SERVER_ROOT/domain/ works out of the box. All files owned by root. This does not make sense to me. OLS running as nobody is able to read files with owner root: but not a non-superuser.

How do you solve this matter with OLS? Can someone please elaborate how you solve this?

Thank you.
 
Last edited:
Top