I am deploying a Strapi project on Azure App Service. Here's what I have done so far:
I deployed the Strapi project using FTP and then ran the necessary commands (npm install, npm run build) in the Azure Kudu console.
After starting the project with npm run develop, the console shows that Strapi started successfully, and it provides a URL like http://localhost:8080/admin.
I also tried deploying the application via GitHub Actions, but the result was the same.
I updated the server.js file in my Strapi project to use the Azure default domain name (.azurewebsites) as the host, but when I try to access the Strapi admin panel through the browser using the Azure default domain, it does not work.
My question is:
How can I make the Strapi admin panel publicly accessible on Azure App Service?
Do I need to map localhost with the Azure default domain somewhere in the configuration?
Any help or guidance on this issue would be greatly appreciated.
Thank you in advance!
I am deploying a Strapi project on Azure App Service. Here's what I have done so far:
I deployed the Strapi project using FTP and then ran the necessary commands (npm install, npm run build) in the Azure Kudu console.
After starting the project with npm run develop, the console shows that Strapi started successfully, and it provides a URL like http://localhost:8080/admin.
I also tried deploying the application via GitHub Actions, but the result was the same.
I updated the server.js file in my Strapi project to use the Azure default domain name (.azurewebsites.net) as the host, but when I try to access the Strapi admin panel through the browser using the Azure default domain, it does not work.
My question is:
How can I make the Strapi admin panel publicly accessible on Azure App Service?
Do I need to map localhost with the Azure default domain somewhere in the configuration?
Any help or guidance on this issue would be greatly appreciated.
Thank you in advance!
Share Improve this question asked Jan 18 at 18:29 Arslan HanifArslan Hanif 233 bronze badges 3 |1 Answer
Reset to default 0I created a sample Strapi application and successfully deployed it to Azure Web App via GitHub actions.
Make sure you add publish URL in your env
file
HOST=0.0.0.0
PORT=1337
PUBLIC_URL=https://<Azureappservice-domain>.azurewebsites.net
Also add PUBLIC_URL in server.js
file
server.js:
export default ({ env }) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
url: env('PUBLIC_URL', 'https://<Azureappservice-domain>.azurewebsites.net')
app: {
keys: env.array('APP_KEYS'),
},
});
Add the below start script to the package.json
file, this helps the correct Strapi start command is executed to launch the application.
"start": "node node_modules/@strapi/strapi/bin/strapi.js start"
Complete package.json:
{
"name": "strapisample",
"version": "0.1.0",
"private": true,
"description": "A Strapi application",
"scripts": {
"build": "strapi build",
"deploy": "strapi deploy",
"develop": "strapi develop",
"start": "node node_modules/@strapi/strapi/bin/strapi.js start",
"strapi": "strapi"
},
"dependencies": {
"@strapi/plugin-cloud": "5.8.0",
"@strapi/plugin-users-permissions": "5.8.0",
"@strapi/strapi": "5.8.0",
"better-sqlite3": "11.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-router-dom": "^6.0.0",
"styled-components": "^6.0.0"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"typescript": "^5"
},
"engines": {
"node": ">=18.0.0 <=22.x.x",
"npm": ">=6.0.0"
},
"strapi": {
"uuid": "8b858a84-0904-4cc4-ae57-38d0cc99d37a"
}
}
- Configure the below startup command in the configuration section of your App service.
pm2 serve /home/site/wwwroot/build --no-daemon --spa
- Also add required environment variables to your Azure App Service environment variable section.
After doing above changes I've successfully deployed the app to Azure Web apps via GitHub actions.
npx create-strapi@latest my-strapi-project
new project is created , I change the database to mysql and then, simply using ftp deploy the project to azure app service directory . I run commands like npm run install , npm run build and npm run start , after this strapi started successfully . but unable to open the strapi page on browser. – Arslan Hanif Commented Jan 18 at 21:18