DocumentRoot outside of /usr/local/lsws

Discussion in 'OpenLiteSpeed Bug Reports' started by enthess, Feb 14, 2017.

  1. enthess

    enthess Member

    Hello!

    I am bringing attention to an old thread (http://openlitespeed.com/threads/virtual-host-root-outside-server_root-gives-404-error.290/#post-790).

    I cant get this to work!
    I have a new server with LSWS under /usr/local/lsws, i have a documentroot in /home/user/html, it contains a single index.php file .
    I only get a 404 not found, i've tried alot of stuff, permissions, shutting off selinux, but nothing works. It works seamless if i put the html-folder under /usr/local/lsws, but not outside of it.

    Please help!

    ping @lsfoo
     
  2. lsfoo

    lsfoo Administrator

    Hi @enthess,

    There are a couple possibilities:
    1. in the vhost settings, is the uid mode set to DocRoot UID?
    2. Is index.php set as an index file?

    Going to think about further possibilities.
     
  3. enthess

    enthess Member

    1. It now is, didnt knew about this option (didnt make a difference)
    2. It is on server-side level, not on vhost-level.
     
  4. lsfoo

    lsfoo Administrator

    Is the vhost set to use server index files?

    Here is a snippet of my local machine's vhost config:

    Code:
    docRoot                   $VH_ROOT/html
    
    index  {
      useServer               0
      indexFiles              index.php
    }
    
    scripthandler  {
      add                     lsapi:lsphp5 php
    }
    
    extprocessor lsphp5 {
      type                    lsapi
      address                 uds://tmp/lshttpd/lsphp5.sock
      maxConns                35
      initTimeout             60
      retryTimeout            0
      persistConn             1
      respBuffer              0
      autoStart               1
      path                    /usr/local/lsws/fcgi-bin/lsphp5
      instances               1
      extUser                 user
      extGroup                user
      priority                0
      memSoftLimit            2047M
      memHardLimit            2047M
      procSoftLimit           400
      procHardLimit           500
    }
    
    rewrite  {
      enable                  1
      rules                   rewriteFile           /home/user/wordpress/html/.htaccess
    }
    
     
  5. enthess

    enthess Member

    Mine now looks the same (except for rewrite).

    The biggest difference is that i have a hardcoded documentroot /home/user/html , whilst vh_root is in /usr/local/lsws default path ($SERVER_ROOT/conf/vhosts/$VH_NAME) , is this a problem, if yes, why ?
     
  6. lsfoo

    lsfoo Administrator

    My vhost settings in the server conf file:

    Code:
    virtualhost localwp {
      vhRoot                  /home/user/wordpress/
      configFile              $SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf
      allowSymbolLink         1
      enableScript            1
      restrained              0
      setUIDMode              2
    }
    
    I'm not sure if hardcoding the document root makes a difference, but that's just what I did because I set the vhRoot to the different directory
     
  7. enthess

    enthess Member

    Heres my vhost:
    virtualhost cgBoxCheck {
    vhRoot $SERVER_ROOT/conf/vhosts/$VH_NAME
    configFile $SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf
    allowSymbolLink 1
    enableScript 1
    restrained 0
    setUIDMode 2
    }

    and here's my vhost-conf

    docRoot /home/user/html/

    errorlog {
    useServer 1
    logLevel ERROR
    }

    accesslog {
    useServer 1
    }

    index {
    useServer 0
    indexFiles index.php
    }

    scripthandler {
    add lsapi:lsphp71 php
    }

    extprocessor lsphp71 {
    type lsapi
    address uds://tmp/lshttpd/lsphp.sock
    maxConns 35
    env PHP_LSAPI_MAX_REQUESTS=500
    env PHP_LSAPI_CHILDREN=35
    initTimeout 60
    retryTimeout 0
    persistConn 1
    respBuffer 0
    autoStart 1
    path $SERVER_ROOT/lsphp71/bin/lsphp
    backlog 100
    instances 1
    extUser user
    extGroup user
    priority 0
    memSoftLimit 2047M
    memHardLimit 2047M
    procSoftLimit 400
    procHardLimit 500
    }



    still, i get 404 not found :/ (file exists ofcourse)
     
  8. lsfoo

    lsfoo Administrator

    Could you enable debug logging and restart the server? We're looking for the part where it parses the configuration files (should be towards the beginning).
     
  9. enthess

    enthess Member

    Code:
    017-02-14 14:50:48.423 [INFO] [PlainConf] [httpServerConfig:] start parsing file /usr/local/lsws/conf/httpd_config.conf
    2017-02-14 14:50:48.423 [INFO] [PlainConf] [httpServerConfig:] Failed to RCS checkin conf file /usr/local/lsws/conf/httpd_config.conf0, ret 32512, error(Invalid argument). Org command is ci -l -q -t-"/usr/local/lsws/conf/httpd_config.conf0" -mUpdate "/usr/local/lsws/conf/httpd_config.conf0" >/dev/null 2>&1.
    2017-02-14 14:50:48.423 [NOTICE] Loading LiteSpeed/1.4.24 Open ...
    2017-02-14 14:50:48.423 [NOTICE] Using [OpenSSL 1.0.2k-dev  xx XXX xxxx]
    2017-02-14 14:50:48.424 [NOTICE] [ADMIN] server socket: uds://usr/local/lsws/admin/tmp/admin.sock.7021
    2017-02-14 14:50:48.424 [NOTICE] Recovering server socket: [*:7080]
    2017-02-14 14:50:48.424 [NOTICE] Recovering server socket: [*:80]
    2017-02-14 14:50:48.424 [NOTICE] chroot is disabled.
    2017-02-14 14:50:48.424 [INFO] old priority: 0, new priority: 0
    2017-02-14 14:50:48.424 [INFO] [config:server:basics2] For better obscurity, server version number is hidden in the response header.
    2017-02-14 14:50:48.431 [INFO] [PlainConf] Failed to RCS checkin conf file /usr/local/lsws/conf/mime.properties0, ret 32512, error(Bad file descriptor). Org command is ci -l -q -t-"/usr/local/lsws/conf/mime.properties0" -mUpdate "/usr/local/lsws/conf/mime.properties0" >/dev/null 2>&1.
    2017-02-14 14:50:48.432 [NOTICE] [PID: 2736]: forked cgid: 2740
    2017-02-14 14:50:48.432 [INFO] [PlainConf] [adminConfig:] start parsing file /usr/local/lsws/admin/conf/admin_config.conf
    2017-02-14 14:50:48.437 [INFO] [PlainConf] [adminConfig:] Failed to RCS checkin conf file /usr/local/lsws/admin/conf/admin_config.conf0, ret 32512, error(Bad file descriptor). Org command is ci -l -q -t-"/usr/local/lsws/admin/conf/admin_config.conf0" -mUpdate "/usr/local/lsws/admin/conf/admin_config.conf0" >/dev/null 2>&1.
    2017-02-14 14:50:48.438 [INFO] [Module: modcompress 1.1] has been initialized successfully
    2017-02-14 14:50:48.438 [INFO] [Module: moddecompress 1.1] has been initialized successfully
    2017-02-14 14:50:48.441 [NOTICE] The maximum number of file descriptor limit is set to 6000.
    2017-02-14 14:50:48.441 [NOTICE] [config:server:epsr:lsphp71] 'Process Limit' probably is too low, adjust the limit to: 620.
    2017-02-14 14:50:48.441 [NOTICE] [config:server:rails] Cannot find ruby interpreter, Rails easy configuration is turned off
    2017-02-14 14:50:48.441 [INFO] [PlainConf] [virtualHostConfig:] start parsing file /usr/local/lsws/conf/vhosts/cgBoxCheck/vhconf.conf
    2017-02-14 14:50:48.447 [INFO] [PlainConf] [virtualHostConfig:] Failed to RCS checkin conf file /usr/local/lsws/conf/vhosts/cgBoxCheck/vhconf.conf0, ret 32512, error(No such file or directory). Org command is ci -l -q -t-"/usr/local/lsws/conf/vhosts/cgBoxCheck/vhconf.conf0" -mUpdate "/usr/local/lsws/conf/vhosts/cgBoxCheck/vhconf.conf0" >/dev/null 2>&1.
    2017-02-14 14:50:48.447 [NOTICE] [config:server:vhosts:vhost:cgBoxCheck:epsr:lsphp71] 'Process Limit' probably is too low, adjust the limit to: 620.
    2017-02-14 14:50:48.448 [NOTICE] [AutoRestarter] new child process with pid=2747 is forked!
    2017-02-14 14:50:48.448 [NOTICE] [AutoRestarter] new child process with pid=2748 is forked!
    2017-02-14 14:50:48.448 [NOTICE] [AutoRestarter] new child process with pid=2749 is forked!
    2017-02-14 14:50:48.448 [NOTICE] [child: 2747] Successfully change current user to nobody
    2017-02-14 14:50:48.448 [NOTICE] Child: 2747] Core dump is enabled.
    2017-02-14 14:50:48.448 [NOTICE] [Child: 2747] Setup swapping space...
    2017-02-14 14:50:48.448 [NOTICE] [Child: 2747] LiteSpeed/1.4.24 Open starts successfully!
    2017-02-14 14:50:48.448 [NOTICE] [AutoRestarter] new child process with pid=2750 is forked!
    2017-02-14 14:50:48.448 [INFO] Stop listener *:7080.
    2017-02-14 14:50:48.448 [INFO] Stop listener *:80.
    2017-02-14 14:50:48.448 [NOTICE] [child: 2748] Successfully change current user to nobody
    2017-02-14 14:50:48.448 [NOTICE] Child: 2748] Core dump is enabled.
    2017-02-14 14:50:48.448 [INFO] Stop listener *:7080.
    2017-02-14 14:50:48.448 [INFO] Stop listener *:80.
    2017-02-14 14:50:48.448 [NOTICE] [Child: 2748] Setup swapping space...
    2017-02-14 14:50:48.448 [NOTICE] [child: 2749] Successfully change current user to nobody
    2017-02-14 14:50:48.448 [NOTICE] Child: 2749] Core dump is enabled.
    2017-02-14 14:50:48.448 [NOTICE] [Child: 2748] LiteSpeed/1.4.24 Open starts successfully!
    2017-02-14 14:50:48.448 [NOTICE] [Child: 2749] Setup swapping space...
    2017-02-14 14:50:48.448 [NOTICE] [Child: 2749] LiteSpeed/1.4.24 Open starts successfully!
    2017-02-14 14:50:48.448 [INFO] Stop listener *:7080.
    2017-02-14 14:50:48.448 [INFO] Stop listener *:80.
    2017-02-14 14:50:48.448 [NOTICE] [child: 2750] Successfully change current user to nobody
    2017-02-14 14:50:48.448 [NOTICE] Child: 2750] Core dump is enabled.
    2017-02-14 14:50:48.448 [NOTICE] [Child: 2750] Setup swapping space...
    2017-02-14 14:50:48.448 [NOTICE] [Child: 2750] LiteSpeed/1.4.24 Open starts successfully!
    2017-02-14 14:50:49.433 [NOTICE] [Child: 2723] Shut down successfully!
    2017-02-14 14:50:49.433 [NOTICE] [AdminPHP] stop worker processes
    2017-02-14 14:50:49.433 [NOTICE] [lsphp71] stop worker processes
    
    No real errors as far as i can see :/
     
  10. lsfoo

    lsfoo Administrator

    Does changing docroot to use VH_ROOT fix it?
     
  11. enthess

    enthess Member

    No :(
     
  12. lsfoo

    lsfoo Administrator

    Could you create an index.html and add it to the list of index files and see if that works?
     
  13. enthess

    enthess Member

    Same :/, i dont know at all what is wrong at the moment :/
     
  14. lsfoo

    lsfoo Administrator

    May I have ssh credentials to log in to your server? Need to do some investigating.
     
  15. enthess

    enthess Member

    Sadly not ..
    I will throw everything away and try again :/
     
  16. lsfoo

    lsfoo Administrator

    OK, let us know if re-doing it fixes it. Since we have the old rules here, we can do a comparison and see if something triggered it.
     
  17. enthess

    enthess Member

    At the moment no changes at all... i dont understand, i point document root to the directory, i have the permissions, everything looks good, no errors :/
     
  18. enthess

    enthess Member

    As soon as i put the document_root under /usr/local/lsws , it works fine!

    same directory, same chmod, same everything.
    When i change to /home/user/html, no working
     
  19. lsfoo

    lsfoo Administrator

    2 questions:

    1. Do both index.php and index.html output the same 404 page?
    2. Is the listener set up properly?
     
  20. enthess

    enthess Member

    Yes, they both generate same 404 page
    As far as i can see, when i put docroot at /lsws/ it works fine , both curl and web.
     

Share This Page