Skip to main content

เนื้อหาภาษาไทย / Thai content

System guide Content reviewed

วิธีติดตั้ง Laravel บน Shared Hosting

วิธีติดตั้ง Laravel บน Shared Hosting

Laravel คือ PHP Framework ที่ถูกออกแบบมาเพื่อใช้ในพัฒนาเว็บแอพพลิเคชั่นแบบ MVC (Model Views Controller) ที่ช่วยให้การเขียนโค้ด อ่าน และแก้ไข ทำได้โดยง่าย

หากคุณต้องการให้ Laravel สามารถทำงานบน Shared Hosting ได้นั้น

ขั้นตอนที่ 1

คุณจำเป็นจะต้องพัฒนา Laravel บนเครื่องของคุณซะก่อน เนื่องจากบน Shared Hosting คุณไม่สามาถใช้ Command Line ในการ Deploy Laravel ผ่าน composer ได้ เมื่อพัฒนาเรียบร้อยแล้วให้ใช้ FTP Upload ไฟล์ Laravel ของคุณขึ้นมายัง Server วางไว้ที่ Folder : public_html หรือ httpdocs

ขั้นตอนที่ 2

ให้คุณตั้งค่าเปลี่ยน Document root มายัง Directory: public โดยให้เพิ่ม Code นี้ลงในไฟล์ .htaccess แล้ว Upload ไปยังตำแหน่งที่ติดตั้ง Laravel

RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]

Office.in.th Custom Service

Want to build or adapt a system from this structure?

Office.in.th designs and develops enterprise web applications, API integrations, and public- and private-sector management systems, with long-term support.

See our software development service