Virtual Host Root outside $SERVER_ROOT gives 404 error

Discussion in 'General OpenLiteSpeed Discussion' started by George_Fusioned, May 26, 2014.

  1. Hello,

    On a CentOS 6.5 server running OLS (I've tried both v1.2.9 & v1.3.2) I've created a new user named "test" (this is just an example) as well as a public_html folder inside.

    Then I created a phpinfo page at /home/test/public_html/phpinfo.php

    Using the "PHP_SuEXEC" Virtual Host Template, I created a new Virtual Host with the following settings:
    Virtual Host Name: test
    Member Virtual Host Root: /home/test
    and instantiated it.

    Finally I went into the Virtual Host -> External App -> Edit and set:
    suEXEC User: test
    suEXEC Group: test

    So my Virtual Host is configured like this:
    Virtual Host Root: /home/test/
    Config File: $SERVER_ROOT/conf/test.xml
    Document Root: $VH_ROOT/public_html/

    File/Directory Permissions:
    /home/test/ is of course owned by test:test
    /home/test/public_html is owned by test:nobody (I also tried test:test)
    all files inside /home/test/public_html/ are owned by test:test

    Unfortunately whatever file I try to access when I visit "", I get a 404 error.

    The only similar discussion I found about this matter is here:!topic/openlitespeed-development/SaL0BeGSAvA
    however I would like to know if there's been any progress towards supporting this.

    If supporting Virtual Host Roots outside of /usr/local/lsws/ is not planned, can you provide an alternative setup where full PHP SuEXEC functionality can be used?
    ie. create a unix user, set ownership of a htdocs/public_html folder to that user, and execute PHP as that user.

    Thanks a lot in advance!
  2. I just tried to setup the whole thing inside /usr/local/lsws/ and apparently it works.

    So now I have:

    Virtual Host Root: $SERVER_ROOT/test

    File/Directory Permissions:
    /usr/local/lsws/test/ and everything underneath (public_html/, files etc.) owned by test:test

    and PHP SuEXEC works nicely :)

    root     29279  0.0  0.2  34752  2944 ?        S    21:40   0:00 openlitespeed (lshttpd - main)
    root     29280  0.0  0.0  33660   908 ?        S    21:40   0:00  \_ openlitespeed (lscgid)
    test     29285  4.0  2.9 160024 29740 ?        S    21:40   0:00  |   \_ lsphp5                       
    test     29286  1.8  2.6 161312 27100 ?        S    21:40   0:00  |   \_ lsphp5                       
    test     29287  3.0  2.5 159296 26020 ?        S    21:40   0:00  |   \_ lsphp5   
    It would be nice to be able to host files outside of /usr/local/lsws/ though :cool:
  3. Tracy Perry

    Tracy Perry Active Member

    It is possible... the only thing you need to point outside of the /usr/local/lsws is actually the document root under the vhost general tab if I remember correctly.
  4. This is what I also thought, but if you read my first message, I already tried this:

  5. Tracy Perry

    Tracy Perry Active Member

    It works.... I was running a site for a guy (3 vhosts) by that process (in fact, they were running in his home directory under a public_html folder).
    The problem I see in your example is you have Document Root as a path relative to the VirtualHost root. I leave the VH root and Config file in the default lsws folder and ONLY place the doc root outside of it (if I remember correctly - I converted most of my sites back over to nginx mainline).
    lsmichael likes this.

Share This Page