This repo explains how to run your Nuxt 3 app on Plesk Obsidian. It took me a couple of hours and a lot of Googling to figure this out. So if it helped you, please star it!
Assuming you have already installed the Node.js extension for Plesk, you can create a new domain in Plesk.
Create the following in the httpdocs directory:
- A new directory called
.output
- A new file called app.js containing the following:
(() => import('./.output/server/index.mjs'))();
Run the following command in the root directory of your app:
yarn build
Copy the contents of the .output
directory to the .output
directory of your domain that you just created.
In the Plesk Control Panel, go to the Node.js page.
Set the Document Root to /httpdocs/.output/public
, and the Application Startup File to app.js
.
In the Hosting & DNS tab, click Apache & nginx Settings. Disable Proxy mode and add the following to the Additional nginx directives:
location ~* \.mjs$ {
types { } default_type "text/javascript; charset=utf-8";
}
location /api/ {
expires 1m;
add_header Cache-Control "public, no-transform";
}