Search code examples
azurestrapi

How do I deploy the STRAPI API on Azure?


I am trying to deploy a STRAPI API on an azure environment, but I can't get it to run.

I have followed these deployment instructions but when I have deployed the source to azure, it only give me a 500 error that I can't find in the logs.

Does anyone have any experience deploying strapi to azure and have some instructions for me?


Solution

  • Alright it was a configuration error.

    First I used the Deployment Center to configure an automatic deployment via Github. This will ensure all the node_modules (including the ones of the plugins) are correctly installed.

    This all went successful, but I kept getting a 500.1001 error without any clear description.

    The thing I needed to change was the port in the server.json in the correct environment.

    From:

    {
      "host": "www.mydomain.com",
      "port": 1337,
      "proxy": {
        "enabled": false
      },
      "autoReload": {
        "enabled": true
      },
      "cron": {
        "enabled": false
      },
      "admin": {
        "autoOpen": false
      }
    }
    

    To:

    {
      "host": "www.mydomain.com",
      "port": "${process.env.PORT || 1337}",
      "proxy": {
        "enabled": false
      },
      "autoReload": {
        "enabled": true
      },
      "cron": {
        "enabled": false
      },
      "admin": {
        "autoOpen": false
      }
    }