Issue with ispconfig additional php versions/Issue regarding laravel deployment

Discussion in 'Server Operation' started by Dimitris, Mar 18, 2021.

  1. Dimitris

    Dimitris New Member

    For the past week I'm trying to deploy my laravel application unsuccessfully and I'm getting error 500 on nginx.A quick look on logs I see these lines indicating that there's something wrong with permissions if I understand correctly. :

    Code:
    2021/03/18 20:39:27 [error] 27390#27390: *5 "/var/www/domain_name/web/public/index.html" is forbidden (13: Permission denied), client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", host: "domain_name"
    2021/03/18 20:39:27 [error] 27390#27390: *5 open() "/var/www/domain_name/web/public/error/403.html" failed (13: Permission denied), client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", host: "domain_name"
    2021/03/18 20:39:27 [error] 27390#27390: *5 open() "/var/www/domain_name/web/public/error/403.html" failed (13: Permission denied), client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", host: "domain_name"
    2021/03/18 20:39:27 [error] 27390#27390: *5 open() "/var/www/domain_name/web/public/error/403.html" failed (13: Permission denied), client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", host: "domain_name"
    2021/03/18 20:39:27 [error] 27390#27390: *5 open() "/var/www/domain_name/web/public/error/403.html" failed (13: Permission denied), client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", host: "domain_name"
    2021/03/18 20:39:27 [error] 27390#27390: *5 open() "/var/www/domain_name/web/public/error/403.html" failed (13: Permission denied), client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", host: "domain_name"
    2021/03/18 20:39:27 [error] 27390#27390: *5 open() "/var/www/domain_name/web/public/error/403.html" failed (13: Permission denied), client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", host: "domain_name"
    2021/03/18 20:39:27 [error] 27390#27390: *5 open() "/var/www/domain_name/web/public/error/403.html" failed (13: Permission denied), client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", host: "domain_name"
    2021/03/18 20:39:27 [error] 27390#27390: *5 open() "/var/www/domain_name/web/public/error/403.html" failed (13: Permission denied), client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", host: "domain_name"
    2021/03/18 20:39:27 [error] 27390#27390: *5 open() "/var/www/domain_name/web/public/error/403.html" failed (13: Permission denied), client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", host: "domain_name"
    2021/03/18 20:39:27 [error] 27390#27390: *5 open() "/var/www/domain_name/web/public/error/403.html" failed (13: Permission denied), client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", host: "domain_name"
    2021/03/18 20:39:27 [error] 27390#27390: *5 rewrite or internal redirection cycle while internally redirecting to "/error/403.html", client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", host: "domain_name"
    
    Code:
    [email protected]:/var/www/domain_name/web# ls -la
    total 1436
    drwxr-x---  15 root root   4096 Mar 17 23:32 .
    drwxr-xr-x   9 root root   4096 Mar 17 19:36 ..
    drwxr-x---   8 root root   4096 Mar 17 19:40 app
    -rwxr-x---   1 root root   1686 Mar 17 19:40 artisan
    drwxr-x---   3 root root   4096 Mar 17 19:40 bootstrap
    -rwxr-x---   1 root root   1766 Mar 17 19:40 composer.json
    -rwxr-x---   1 root root 313701 Mar 17 22:37 composer.lock
    drwxr-x---   2 root root   4096 Mar 17 19:40 config
    drwxr-x---   5 root root   4096 Mar 17 19:40 database
    -rwxr-x---   1 root root    220 Mar 17 19:40 .editorconfig
    -rwxr-x---   1 root root    916 Mar 17 23:32 .env
    -rwxr-x---   1 root root    794 Mar 17 19:40 .env.example
    drwxr-x---   2 root root   4096 Mar 17 19:36 error
    -rwxr-x---   1 root root  34980 Mar 17 19:40 error.log
    -rwxr-x---   1 root root   7358 Mar 17 19:36 favicon.ico
    -rwxr-x---   1 root root    111 Mar 17 19:40 .gitattributes
    -rwxr-x---   1 root root    163 Mar 17 19:40 .gitignore
    -rwxr-x---   1 root root     22 Mar 17 19:39 info.php
    drwxr-x--- 703 root root  20480 Mar 17 20:48 node_modules
    -rwxr-x---   1 root root   1093 Mar 17 19:40 package.json
    -rwxr-x---   1 root root 964187 Mar 17 19:40 package-lock.json
    -rwxr-x---   1 root root   1202 Mar 17 19:40 phpunit.xml
    drwxr-x---   6 root root   4096 Mar 17 20:51 public
    -rwxr-x---   1 root root   3738 Mar 17 19:40 README.md
    drwxr-x---   7 root root   4096 Mar 17 20:15 resources
    -rwxr-x---   1 root root     14 Mar 17 19:36 robots.txt
    drwxr-x---   2 root root   4096 Mar 17 19:40 routes
    -rwxr-x---   1 root root    563 Mar 17 19:40 server.php
    -rwxr-x---   1 root root   1862 Mar 17 19:36 standard_index.html
    drwxr-x---   2 root root   4096 Mar 18 02:04 stats
    drwxrws---   5 root root   4096 Mar 17 20:16 storage
    -rwxr-x---   1 root root    181 Mar 17 19:40 .styleci.yml
    drwxr-x---   4 root root   4096 Mar 17 20:16 tests
    drwxr-x---  52 root root   4096 Mar 17 22:37 vendor
    -rwxr-x---   1 root root    544 Mar 17 19:40 webpack.mix.js
    
    vhost conf :
    Code:
    server {
            listen 165.22.71.31:80;
            listen 165.22.71.31:443 ssl http2;
    
        ssl_protocols TLSv1.3 TLSv1.2;
            ssl_certificate /var/www/clients/client0/web8/ssl/domain_name-le.crt;
            ssl_certificate_key /var/www/clients/client0/web8/ssl/domain_name-le.key;
    
            server_name domain_name www.domain_name;
    
            root   /var/www/domain_name/web/public;
            disable_symlinks if_not_owner from=$document_root;
    
    
            index index.html index.htm index.php index.cgi index.pl index.xhtml standard_index.html;
    
    
            error_page 400 /error/400.html;
            error_page 401 /error/401.html;
            error_page 403 /error/403.html;
            error_page 404 /error/404.html;
            error_page 405 /error/405.html;
            error_page 500 /error/500.html;
            error_page 502 /error/502.html;
            error_page 503 /error/503.html;
            recursive_error_pages on;
            location = /error/400.html {
    
                internal;
                auth_basic off;
            }
            location = /error/401.html {
    
                internal;
                auth_basic off;
            }
            location = /error/403.html {
    
                internal;
                auth_basic off;
            }
            location = /error/404.html {
    
                internal;
                auth_basic off;
            }
            location = /error/405.html {
    
                internal;
                auth_basic off;
            }
            location = /error/500.html {
    
                internal;
                auth_basic off;
            }
            location = /error/502.html {
    
                internal;
                auth_basic off;
            }
            location = /error/503.html {
    
                internal;
                auth_basic off;
            }
    
            error_log /var/log/ispconfig/httpd/domain_name/error.log;
            access_log /var/log/ispconfig/httpd/domain_name/access.log combined;
    
            location ~ /\. {
                deny all;
            }
    
            location ^~ /.well-known/acme-challenge/ {
                access_log off;
                log_not_found off;
                auth_basic off;
                root /usr/local/ispconfig/interface/acme/;
                autoindex off;
                index index.html;
                try_files $uri $uri/ =404;
            }
    
            location = /favicon.ico {
                log_not_found off;
                access_log off;
                expires max;
                add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            }
    
            location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
            }
    
            location /stats/ {
    
                index index.html index.php;
                auth_basic "Members Only";
                auth_basic_user_file /var/www/clients/client0/web8/web//stats/.htpasswd_stats;
                add_header Content-Security-Policy "default-src * 'self' 'unsafe-inline' 'unsafe-eval' data:;";
            }
    
            location ^~ /awstats-icon {
                alias /usr/share/awstats/icon;
            }
    
            location ~ \.php$ {
                try_files /2e84bacf83fef64175a7223a7c751d66.htm @php;
            }
    
            location @php {
                try_files $uri =404;
                include /etc/nginx/fastcgi_params;
                fastcgi_pass unix:/var/lib/php7.3-fpm/web8.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_intercept_errors on;
            }
    
    
    
    
    
    
    
    }
    
    However if you take a closer look on this file,you can see that it shows php7.3-fpm being used even though i have specifically selected php 8.0 on ispconfig .

    Screenshot_20210318_204837.png Screenshot_20210318_204902.png

    I don't know if it has anything to do with it but I'm trying to deploy it from a Linux system and more specifically manjaro.

    Can anyone please help me with this permissions and php issue?
    Thank you very much in advance
     
    Last edited: Mar 23, 2021
  2. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    The files in the web folder should be owned by the web user and client group. So if the web user is 12, and the client ID is 34, you should run
    Code:
    chown -R web12:client34 /var/www/clients/client34/web12/web
    You can find these in the web settings (the path will be shown with the correct IDs)
     
  3. Dimitris

    Dimitris New Member

    Thank you for your reply . What if there aren't any clients? and there is only a root user?
     
  4. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    This is not possible. If the web is added by the sdmin user and does not belong to a client created in ISPConfig, the group would be client0 - you can see this in the path.
     
  5. Dimitris

    Dimitris New Member

    i tried what you suggested with
    Code:
    chown -R web8:client0 /var/www/clients/client0/web8/web
    
    but nothing changed. Still having the Error 500 message.
     
  6. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Can you share the current file permissions of /web?
     
  7. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Also, is SUExec enabled for the site?
     
  8. Dimitris

    Dimitris New Member

    Code:
    drwxr-x---  15 web8 client0   4096 Mar 17 23:32 .
    drwxr-xr-x   9 root root      4096 Mar 17 19:36 ..
    drwxr-x---   8 web8 client0   4096 Mar 17 19:40 app
    -rwxr-x---   1 web8 client0   1686 Mar 17 19:40 artisan
    drwxr-x---   3 web8 client0   4096 Mar 17 19:40 bootstrap
    -rwxr-x---   1 web8 client0   1766 Mar 17 19:40 composer.json
    -rwxr-x---   1 web8 client0 313701 Mar 17 22:37 composer.lock
    drwxr-x---   2 web8 client0   4096 Mar 17 19:40 config
    drwxr-x---   5 web8 client0   4096 Mar 17 19:40 database
    -rwxr-x---   1 web8 client0    220 Mar 17 19:40 .editorconfig
    -rwxr-x---   1 web8 client0    916 Mar 17 23:32 .env
    -rwxr-x---   1 web8 client0    794 Mar 17 19:40 .env.example
    drwxr-x---   2 web8 client0   4096 Mar 17 19:36 error
    -rwxr-x---   1 web8 client0  34980 Mar 17 19:40 error.log
    -rwxr-x---   1 web8 client0   7358 Mar 17 19:36 favicon.ico
    -rwxr-x---   1 web8 client0    111 Mar 17 19:40 .gitattributes
    -rwxr-x---   1 web8 client0    163 Mar 17 19:40 .gitignore
    -rwxr-x---   1 web8 client0     22 Mar 17 19:39 info.php
    drwxr-x--- 703 web8 client0  20480 Mar 17 20:48 node_modules
    -rwxr-x---   1 web8 client0   1093 Mar 17 19:40 package.json
    -rwxr-x---   1 web8 client0 964187 Mar 17 19:40 package-lock.json
    -rwxr-x---   1 web8 client0   1202 Mar 17 19:40 phpunit.xml
    drwxr-x---   6 web8 client0   4096 Mar 17 20:51 public
    -rwxr-x---   1 web8 client0   3738 Mar 17 19:40 README.md
    drwxr-x---   7 web8 client0   4096 Mar 17 20:15 resources
    -rwxr-x---   1 web8 client0     14 Mar 17 19:36 robots.txt
    drwxr-x---   2 web8 client0   4096 Mar 17 19:40 routes
    -rwxr-x---   1 web8 client0    563 Mar 17 19:40 server.php
    -rwxr-x---   1 web8 client0   1862 Mar 17 19:36 standard_index.html
    drwxr-x---   2 web8 client0   4096 Mar 18 02:04 stats
    drwxrws---   5 web8 client0   4096 Mar 17 20:16 storage
    -rwxr-x---   1 web8 client0    181 Mar 17 19:40 .styleci.yml
    drwxr-x---   4 web8 client0   4096 Mar 17 20:16 tests
    drwxr-x---  52 web8 client0   4096 Mar 17 22:37 vendor
    -rwxr-x---   1 web8 client0    544 Mar 17 19:40 webpack.mix.js
    
     
  9. Dimitris

    Dimitris New Member

  10. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Ah, yes.

    Your additional PHP version seems to be set up incorrectly aswell, it should be like this:

    FastCGI settings:
    Path to the PHP FastCGI binary: php-cgi8.0
    Path to the php.ini directory: /etc/php/8.0/cgi/php.ini

    PHP-FPM Settings:
    Path to the PHP-FPM init script: php8.0-fpm
    Path to the php.ini directory: /etc/php/8.0/fpm/php.ini
    Path to the PHP-FPM pool directory: /etc/php/8.0/fpm/pool.d
     
  11. Dimitris

    Dimitris New Member

    Still having 500 Internal Server errors. This is from the error log :
    Code:
    2021/03/18 23:27:10 [error] 6546#6546: *7 openat() "/var/www/domain_name/web/public/error/500.html" failed (2: No such file or directory), client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/lib/php7.3-fpm/web8.sock", host: "domain_name"
    2021/03/18 23:27:10 [error] 6546#6546: *7 openat() "/var/www/domain_name/web/public/error/404.html" failed (2: No such file or directory), client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/lib/php7.3-fpm/web8.sock", host: "domain_name"
    2021/03/18 23:27:10 [error] 6546#6546: *7 openat() "/var/www/domain_name/web/public/error/404.html" failed (2: No such file or directory), client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/lib/php7.3-fpm/web8.sock", host: "domain_name"
    2021/03/18 23:27:10 [error] 6546#6546: *7 openat() "/var/www/domain_name/web/public/error/404.html" failed (2: No such file or directory), client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/lib/php7.3-fpm/web8.sock", host: "domain_name"
    2021/03/18 23:27:10 [error] 6546#6546: *7 openat() "/var/www/domain_name/web/public/error/404.html" failed (2: No such file or directory), client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/lib/php7.3-fpm/web8.sock", host: "domain_name"
    2021/03/18 23:27:10 [error] 6546#6546: *7 openat() "/var/www/domain_name/web/public/error/404.html" failed (2: No such file or directory), client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/lib/php7.3-fpm/web8.sock", host: "domain_name"
    2021/03/18 23:27:10 [error] 6546#6546: *7 openat() "/var/www/domain_name/web/public/error/404.html" failed (2: No such file or directory), client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/lib/php7.3-fpm/web8.sock", host: "domain_name"
    2021/03/18 23:27:10 [error] 6546#6546: *7 openat() "/var/www/domain_name/web/public/error/404.html" failed (2: No such file or directory), client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/lib/php7.3-fpm/web8.sock", host: "domain_name"
    2021/03/18 23:27:10 [error] 6546#6546: *7 rewrite or internal redirection cycle while internally redirecting to "/error/404.html", client: 89.210.91.232, server: domain_name, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/lib/php7.3-fpm/web8.sock", host: "domain_name"
    
     
    Last edited: Mar 23, 2021
  12. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Have you changed the base dir of the web? it seems that it is looking in web/public instead web/ ?
     
    Dimitris likes this.
  13. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    Turn off 'own error documents' in the website settings.
     
    Dimitris likes this.
  14. Dimitris

    Dimitris New Member

    Yes this is correct. I have changed it because of the laravel folder structure .
     
  15. Dimitris

    Dimitris New Member


    Yes ,this seem to do the trick. Thank you very much . Th0m thank you as well for your time.
     

Share This Page