Reputation: 51
In this way I can run astro in dev mode with specific network and port.
npm run dev -- --host --port=3011
But how to run Astro production? Im working before with Nextjs, and in Nextjs i can do this with: npm run start, but looks like this way astro also in running in dev mode.
i try
npx astro preview -- --host --port=3011
But in this way astro is loaded in port 4321, so looks like not read called port in this way.
@update
I try also in config file:
export default defineConfig({
server: {
port: 3011,
host: true,
},
output: "server",
integrations: [
tailwind({
config: {
applyBaseStyles: false,
},
}),
svelte(),
],
adapter: node({
mode: "standalone",
}),
});
Now when I try: npx astro preview then run on port 3011 but wihout network true (so website is only accessable from localhost).
When I run
npm run dev -- --host --port=3011
Then working with port and network.
SSH:
[d9yfcre2@server xxxxx]$ npm run dev
> [email protected] dev
> astro dev
astro v4.2.8 ready in 521 ms
┃ Local http://localhost:3011/
┃ Network http://public_ip:3011/
22:34:11 watching for file changes...
Dev mode working and network working (proxy pass domain is also working). Now with preview:
[d9yfcre2@server xxxx]$ npx astro preview
22:35:13 [@astrojs/node] Server listening on http://localhost:3011
Network not working. Only curl localhost:3011 from root working, . Maybe I should edit anything in node adapter? I use ngnix + node 18
Upvotes: 1
Views: 707
Reputation: 4599
The only solution I found is to run the build directly:
astro build
node dist/server/entry.mjs
Upvotes: 0