Announcement

Collapse
No announcement yet.

Run PHP and Nodejs app together in a cPanel account

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Run PHP and Nodejs app together in a cPanel account

    I have installed Nodejs on my cPanel Cloudlinux server.

    I created a Nodejs app (Nuxt.js) for my website frotend via "Software > Setup Node.js App" in my cPanel account and linked it to my website root (example.com/).
    After that, I created a subdomain called "api". Now I want to build an API PHP service (Laravel) for my website backend and place it in my "api.example.com" directory which it returns JSON from this address.
    But when I visit this url, it returns my Nodejs app page which I created before for website root.

    In fact, I want the "publci_html/api" folder (which is pointing to api.example.com) to be exclude from rendering via Nodejs server.

    Is it possible?
    Or should I commit some changes in ".htaccess" file?

    Regards

  • #2
    Hello Simon,
    Thank you for reaching out! Did you manage to get an answer from cPanel to this question https://forums.cpanel.net/threads/ru.../#post-2721253 ? If you have any questions, please let me know. Thanks in advance!

    Comment


    • #3
      > Hello Simon,
      > Thank you for reaching out! Did you manage to get an answer from cPanel to this question https://forums.cpanel.net/threads/ru.../#post-2721253 ? If you have any questions, please let me know. Thanks in advance!

      I didnt get convincing answer from cPanel forum. Because their guidance was according to the cPanel documentions which is different from CloudLinux. For example there isnt any Application Manager or Easy Apache 4 in Cloudlinux based system.

      Comment


      • #4
        Simon,
        To solve your problem, please add the "PassengerEnabled off" directive to the htaccess file of your subdomain.
        You can find more information on this directive here https://www.phusionpassenger.com/lib...ssengerenabled
        If you have any other questions, feel free to ask here. Thank you for contacting us.

        Comment


        • #5
          I suggest you create api.domain.com as a subdomain so you can use api.domain.com (public_html/API) for the Laravel application without any problem.

          But if you have .httacess in the root directory and Node.js use rewrite rules, you can also add RewriteRule code to excluding :

          RewriteRule ^(API)($|/) - [L]

          mcdvoice

          Comment


          • #6
            > I suggest you create api.domain.com as a subdomain so you can use api.domain.com (public_html/api) for the Laravel application without any problem.
            >
            > But if you have .httacess in the root directory and Node.js use rewrite rules, you can also add RewriteRule code to excluding :
            >
            > RewriteRule ^(api)($|/) - [L]

            Hello Piper,
            Thanks for following up!

            Comment

            Working...
            X