Issue with locating files on Subdomain

Discussion in 'ISPConfig 3 Priority Support' started by Zinxx, Feb 6, 2021.

  1. Zinxx

    Zinxx New Member HowtoForge Supporter

    Greetings Folks! How yall doing?
    I have been using ISPConfig for over a year now, and i find the application incredible great for managing a server, so thank you for that.
    Past couple days i have been trying to figure out why its happening and i could not fix on my own, so lets begin.

    I run a laravel app on PHP 5.6 on a Subdomain, so i created a subdomain inside ISPConfig3 and marked as redirect with no marks to my path destination which is: "/teste/" inside the .vhost file, we can find this info:

    }
    if ($http_host = "teste.domain.com") {
    rewrite ^(?!/(teste|stats|\.well-known/acme-challenge))/(.*)$ /teste/$1 ;
    }

    When we access the "teste.domain.com" it returns the index page, but "Images, css, JS, or anykind of external file" gets this error:
    Failed to load resource: the server responded with a status of 404 (Not Found)

    The thing is, the file exists in the root directory, but somehow it cant be found thru a subdomain, only at root directory, example: domain.com/teste/

    The Laravel app requires me to use a subdomain, otherwise the functions of it will not work.

    Can someone enlight me? Thank you!!!
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Delete the subdomain and add a vhost subdomain instead where you use 'teste' as folder in the path setting (don't set any kind of redirect).
     
    Zinxx likes this.
  3. Zinxx

    Zinxx New Member HowtoForge Supporter

    Hello Till, thank you for your reply.
    Could you guide me how to set a vhost instead of redirect?
    Thank you once again for your support.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Activate vhost sub- and alias domain feature under System > Interface > Main config. Then add a new vhost subdomain in the sites module, you will find a new menu item for that in the left side menu of the sites module.
     
    Zinxx likes this.
  5. Zinxx

    Zinxx New Member HowtoForge Supporter

    Hello again!
    After doing what you instructed me to do, the server returns ERROR 500 now.
    The error log file outputs:

    2021/02/07 09:45:24 [crit] 125087#125087: *97 openat() "/var/www/domain.com/web/bfadmincp/bfadmincp/public/" failed (13: Permission denied), client: 179.214.*.*, server: domain.com, request: "GET / HTTP/1.1", host: "domain.com"
    2021/02/07 09:45:24 [error] 125087#125087: *97 FastCGI sent in stderr: "PHP message: PHP Warning: require(): open_basedir restriction in effect. File(/var/www/clients/client0/web14/web/bfadmincp/bfadmincp/bootstrap/autoload.php) is not within the allowed path(s)

    So i checked the user and group which belongs to domain.com, and everything is correct, the user is web14 and the group is client0.
     
  6. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    What's in PHP base_dir under the options tab of this vhost (of the subdomain)?
     
  7. Zinxx

    Zinxx New Member HowtoForge Supporter

    This is the base_dir currently:
    /var/www/clients/client0/web14/web/bfadmincp/bfadmincp/public:/var/www/clients/client0/web14/private:/var/www/clients/client0/web14/tmp:/var/www/i/web/bfadmincp/bfadmincp/public/:/srv/www/i/web/bfadmincp/bfadmincp/public:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom:/var/www/clients/client0/web14/web/bfadmincp/bfadmincp/bootstrap/autoload.php
     
    Last edited: Feb 9, 2021
  8. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Can you try creating this web as site instead of vhost subdomain, so it gets it's own folders?
     
  9. Zinxx

    Zinxx New Member HowtoForge Supporter

    The thing is, this laravel app has a /public/ folder which has to be the main root, and when we create a subdomain as web, we cant direct it towards the /public/.
    The fun fact is, it always worked nicely, i have removed for 2 days and then readded back and now this issue.
     
  10. Zinxx

    Zinxx New Member HowtoForge Supporter

    I have fixed the issue. Had to edit Nginx Config files.
    Thanks for you time.
     

Share This Page