Merhaba,
Plesk'te Next.js 14 uygulamamı deploy ediyorum ancak "End of script output before headers" hatası alıyorum.
**Detaylar*
- Node.js: 24.11.1
- Next.js: 14.2.5
- Startup File: node_modules/.bin/next
- Application Root: /httpdocs
**Hata* Apache error log'da "End of script output before headers" görünüyor, sürekli 500 hatası alıyorum.
**Denenenler*
- Startup file kontrol edildi
- .next klasörü yüklendi
- npm install çalıştırıldı
- Node.js restart edildi
Next.js için doğru startup file ayarı nedir? Yardımcı olabilir misiniz?
Teşekkürler.
Node Js production hatası
4
●96
- 22-11-2025, 12:18:58Merhaba! Bu hata Plesk’te Node uygulamasının “startup file” olarak bir çalıştırılabilir dosya (node_modules/.bin/next) verilmesinden veya Next’i Plesk’in istediği şekilde bir entrypoint ile başlatamamasından kaynaklanıyor. Plesk, “Application Startup File” alanında mutlaka Application Root içindeki bir .js dosyasını bekler (server.js / app.js gibi).
1-Projenizin köküne server.js oluştu
// server.js const { createServer } = require("http"); const next = require("next"); const port = parseInt(process.env.PORT, 10) || 3000; const dev = false; const app = next({ dev }); const handle = app.getRequestHandler(); app.prepare().then(() => { createServer((req, res) => handle(req, res)).listen(port, "0.0.0.0", (err) => { if (err) throw err; console.log(`> Ready on http://localhost:${port}`); }); });Bu dosya Plesk’in verdiği process.env.PORT üzerinden dinler; Plesk Node.js uygulamalarında böyle bir entry dosyasıyla başlatma yaygın ve önerilen yöntem.
2-package.json scriptlerini şöyle ayarla:
{ "scripts": { "build": "next build", "start": "node server.js" } }- Plesk Node.js ayarları:
- Application Root: /httpdocs
- Application Startup File: server.js
- Application Mode: production
- Sonra sırayla NPM install ve NPM run build çalıştırın, ardından “Restart App”.
bunları yapınca çalışır diye düşünüyorum hocam - 22-11-2025, 12:23:24
- httpdocs içinde:
- package.json
- next.config.js
- .next (build sonrası)
- server.js (Seçenek B kullanıyorsan)
- npm install ve npm run build çalışmış olacak.
- Plesk Node.js:
- Application root: httpdocs
- Startup file: server.js veya App startup komutu: npm start
- NODE_ENV=production
- PORT ile next start aynı portu kullanıyor.
- Node.js versiyonu Plesk’te de gerçekten 24.x olarak seçili.
demiş chatgpt 5 - httpdocs içinde:
- 22-11-2025, 15:16:40Bu cevap, konu sahibi tarafından kabul edilebilir bir cevap olarak işaretlendi.Ssh yetkisi varsa terminalde calistirip pleskten proxy olarak kullanın