Admin panel deployment
The front-end part of Strapi is called the admin panel. The admin panel presents a graphical user interface to help you structure and manage the content that will be accessible to your application's own front-end through Strapi's Content API.
The admin panel is a React-based single-page application that encapsulates all the features and installed plugins of a Strapi application.
The back-end server of Strapi serves the Content API which provides endpoints to your content.
By default, the back-end server and the admin panel server are deployed on the same server. But the admin panel and the back-end server are independent and can be deployed on different servers, which brings us to different scenarios:
- Deploy the entire project on the same server.
- Deploy the administration panel on a server (AWS S3, Azure, etc) different from the API server.
Build configurations differ for each case.
Before deployment, the admin panel needs to be built, by running the following command from the project's root directory:
- yarn
- npm
yarn build
npm run build
This will replace the folder's content located at ./build
. Visit http://localhost:1337/admin to make sure customizations have been taken into account.
Same server
Deploying the admin panel and the back end (API) of Strapi on the same server is the default behavior. The build configuration will be automatically set. The server will start on the defined port and the administration panel will be accessible through http://yourdomain.com:1337/admin
.
You might want to change the path to access the administration panel.
Different servers
To deploy the admin panel and the back end (API) of Strapi on different servers, use the following configuration:
- JavaScript
- TypeScript
module.exports = ({ env }) => ({
host: env("HOST", "0.0.0.0"),
port: env.int("PORT", 1337),
url: "http://yourbackend.com",
});
module.exports = ({ env }) => ({
/**
* Note: The administration will be accessible from the root of the domain
* (ex: http://yourfrontend.com/)
*/
url: "/",
serveAdminPanel: false, // http://yourbackend.com will not serve any static admin files
});
export default ({ env }) => ({
host: env("HOST", "0.0.0.0"),
port: env.int("PORT", 1337),
url: "http://yourbackend.com",
});
export default ({ env }) => ({
/**
* Note: The administration will be accessible from the root of the domain
* (ex: http://yourfrontend.com/)
*/
url: "/",
serveAdminPanel: false, // http://yourbackend.com will not serve any static admin files
});
After running yarn build
with this configuration, the build
folder will be created/overwritten. Use this folder to serve it from another server with the domain of your choice (e.g. http://yourfrontend.com
).
The administration URL will then be http://yourfrontend.com
and every request from the panel will hit the backend at http://yourbackend.com
.
If you add a path to the url
option, it won't prefix your application. To do so, use a proxy server like Nginx (see optional software deployment guides).