วิธีสร้าง FiveM Server Key ปี 2026 ตั้งแต่ Cfx Portal จนใส่ใน server.cfg
การ สร้าง FiveM Server Key เป็นขั้นตอนสำคัญก่อนเปิด FiveM Server เพราะ FXServer ใช้ Server Registration Key สำหรับลงทะเบียน Server กับระบบ Cfx.re
วิธีสร้างแบบปัจจุบันคือ
Login Cfx Account
↓
เข้า Cfx Portal
↓
Create a key
↓
ตั้ง Display Name
↓
Generate
↓
Copy Server Key
↓
ใส่ใน txAdmin หรือ server.cfg
↓
เปิด FXServer
↓
ตรวจ Console
หากใช้ txAdmin Recipe สามารถสร้าง Key จาก Portal ระหว่างขั้นตอน Deploy แล้วนำ Key กลับมาใส่ใน txAdmin ได้ทันที
① ก่อนสร้าง FiveM Server Key ต้องมีอะไร
เตรียม
Cfx Account
FXServer
txAdmin หรือ
server.cfgInternet
Server Environment ที่จะใช้งาน
หากยังไม่มี Cfx Account ต้องสร้างและยืนยัน Account ก่อน เพราะ Cfx.re ใช้ Account นี้ในการ Setup Server
② FiveM Server Key เรียกว่าอะไร
อาจพบหลายชื่อ เช่น
FiveM Server Key
Cfx Server Key
Server Registration Key
License Key
ใน server.cfg จะใช้กับ
sv_licenseKey "YOUR_SERVER_KEY"
③ Server Key สร้างที่ไหน
สร้างผ่าน Cfx Portal
คู่มือ Cfx.re ปัจจุบันให้เข้า Portal ระหว่างขั้นตอน Setup Server แล้วเลือก
Create a key
จากนั้นตั้ง Display Name และกด Generate
④ ต้อง Login Cfx Account ก่อน
ใช่
Server Registration Key จะเกี่ยวข้องกับ Cfx Account ที่ใช้บริหาร Server
ดังนั้นเจ้าของ Production Server ควรใช้ Account ที่สามารถควบคุมได้ในระยะยาว
ไม่ควรสร้าง Key ด้วย Account ชั่วคราวของ Staff ที่อาจออกจากทีมภายหลัง
⑤ วิธีสร้าง FiveM Server Key แบบสั้นที่สุด
ขั้นตอนคือ
1. Login Cfx Account
2. เข้า Cfx Portal
3. เลือก Create a key
4. ตั้ง Display Name
5. กด GENERATE
6. เปิด Key ที่สร้าง
7. กด Copy
8. นำไปใส่ txAdmin หรือ server.cfg
นี่เป็น Flow ตามคู่มือ Setup ปัจจุบันของ Cfx.re
⑥ Display Name คืออะไร
Display Name คือชื่อที่ช่วยให้คุณจำได้ว่า Key นี้เกี่ยวข้องกับ Server ใด
ตัวอย่าง
FiveM Production
FiveM Development
FiveM Test
Thai RP Production
ควรตั้งชื่อให้เข้าใจได้แม้กลับมาดูอีกหลายเดือนภายหลัง
⑦ Display Name ต้องเหมือนชื่อ Server ไหม
ไม่จำเป็น
เช่น Key อาจตั้งว่า
PRODUCTION-01
แต่ Server ที่ผู้เล่นเห็นอาจชื่อ
My Thai Roleplay
Display Name มีไว้ช่วยบริหาร Registration ของคุณ
⑧ ตั้งชื่อ Key แบบไหนดี
ถ้ามีหลาย Server แนะนำรูปแบบ
ชื่อโปรเจกต์ - Environment
เช่น
MYRP-PROD
MYRP-DEV
MYRP-TEST
ช่วยลดโอกาสหยิบ Key ผิดตัว
⑨ ไม่ควรตั้งชื่อ Key แบบไหน
หลีกเลี่ยงชื่ออย่าง
key
key1
newkey
test
final
final2
เพราะเมื่อมีหลาย Registration จะจำไม่ได้ว่าแต่ละ Key ใช้กับ Server ไหน
⑩ กด GENERATE แล้วทำอะไรต่อ
หลังระบบสร้าง Key แล้ว
เปิด Key ที่เพิ่งสร้างและใช้คำสั่ง Copy ตามหน้า Portal
จากนั้นนำค่าไปใส่ใน
txAdmin Recipe
หรือ
server.cfg
ตามวิธีสร้าง Server ที่คุณใช้
⑪ ถ้าใช้ txAdmin ต้องใส่ Key ตรงไหน
ตอนสร้าง Server ผ่าน Recipe Deployer จะมีช่วง
Step 1: Review Recipe
↓
Step 2: Input Parameters
ในขั้น Input Parameters จะมีช่องสำหรับ Server Registration Key
นำ Key จาก Cfx Portal มาวางแล้วกด
Run Recipe
⑫ txAdmin มีปุ่มไป Portal ไหม
คู่มือ Setup ปัจจุบันระบุว่าใน Input Parameters มี Portal link
สามารถเปิด Portal จากจุดนั้น
จากนั้น
Sign in
→ Create a key
→ Display Name
→ Generate
→ Copy
แล้วกลับมาวาง Key ใน txAdmin
⑬ Recipe ทำอะไรกับ Key
Recipe สามารถนำ Server Key ที่กรอกไปใช้ในการสร้าง Configuration ของ Server
จึงลดขั้นตอนที่ต้องเปิด server.cfg แล้วใส่ Key ด้วยตัวเอง
หลัง Deploy เสร็จควรตรวจ Config อีกครั้งก่อน Production
⑭ ถ้าไม่ใช้ txAdmin ทำอย่างไร
ถ้าเปิด Vanilla FXServer ให้สร้าง server.cfg แล้วใส่
sv_licenseKey "YOUR_SERVER_KEY"
เปลี่ยน YOUR_SERVER_KEY เป็น Key ที่ Copy มาจาก Cfx Portal
⑮ ตัวอย่าง server.cfg
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
sv_hostname "My FiveM Server"
set onesync on
sv_maxclients 48
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
sv_licenseKey "YOUR_SERVER_KEY"
นี่เป็นตัวอย่างพื้นฐาน ต้องปรับให้ตรงกับ Server จริง
⑯ sv_licenseKey คืออะไร
sv_licenseKey เป็น Server Variable สำหรับกำหนด License/Registration Key ของ Server
รูปแบบคือ
sv_licenseKey "KEY"
FXServer จะอ่านค่าจาก Configuration เมื่อเริ่ม Server
⑰ ต้องใส่ set หน้า sv_licenseKey ไหม
ไม่จำเป็นตามรูปแบบ Configuration ทางการ
ใช้
sv_licenseKey "YOUR_SERVER_KEY"
ได้โดยตรง
ไม่ต้องเขียนเป็น
set sv_licenseKey "YOUR_SERVER_KEY"
⑱ Key ควรอยู่ตรงไหนใน server.cfg
สามารถวางใน Configuration ที่ FXServer โหลด แต่เพื่อให้อ่านง่ายนิยมจัดไว้ในส่วน Registration
เช่น
# Server Registration
sv_licenseKey "YOUR_SERVER_KEY"
ช่วยให้หาได้ง่ายเวลาย้าย Server หรือ Debug
⑲ ต้องใส่ Quote หรือไม่
ใช้รูปแบบ
sv_licenseKey "YOUR_SERVER_KEY"
จะอ่านง่ายและตรงกับรูปแบบที่ใช้ในคู่มือ Vanilla Server
อย่า Copy Space หรือ Character แปลก ๆ ติดมากับ Key
⑳ เปิด Vanilla Server หลังใส่ Keyอย่างไร
Windows ตัวอย่าง
cd /d C:\FXServer\server-data
C:\FXServer\server\FXServer.exe +exec server.cfg
ต้อง Run จาก Server Data Directory ที่ถูกต้อง
㉑ Linux เปิดอย่างไร
ตัวอย่างตามโครงสร้างมาตรฐาน
cd ~/FXServer/server-data
bash ~/FXServer/server/run.sh +exec server.cfg
Path ต้องปรับให้ตรงกับเครื่องจริง
㉒ ถ้าใช้ txAdmin อย่าเปิดแบบ Vanilla สับสนกัน
txAdmin ต้องทำงานใน Monitor Mode
ดังนั้น Process หลักของ txAdmin ไม่ควรเปิดด้วย
+exec server.cfg
เหมือน Vanilla Setup
ให้ txAdmin จัดการ Server Instance และ Configuration ของมันเอง
㉓ สร้าง Key แล้วต้อง Restart Server ไหม
ถ้า Server กำลังทำงานด้วย Key เก่าและคุณเปลี่ยน sv_licenseKey ใน Configuration ควร Restart FXServer เพื่อให้ Configuration ใหม่ถูกอ่าน
จากนั้นตรวจ Live Console
㉔ ตรวจว่า Key ทำงานได้อย่างไร
เปิด Server แล้วดู Console
ถ้าไม่มี License Error และ Server Startup เดินหน้าตามปกติ แสดงว่าขั้น Registration ผ่านขั้นตอนที่เกี่ยวข้องแล้ว
จากนั้นต้องทดสอบ Network และ Player Connection ต่อด้วย
㉕ ถ้าขึ้น no license key was specified
ข้อความลักษณะ
no license key was specified
ไม่ได้หมายความว่าต้องสร้าง Key ใหม่ทันที
ให้ตรวจก่อนว่า
server.cfg มี sv_licenseKey หรือไม่
server.cfg ถูกโหลดหรือไม่
เปิดจาก Directory ถูกหรือไม่
+exec server.cfg ถูกหรือไม่
㉖ server.cfg ไม่ถูกโหลดทำให้เหมือน Key หายได้ไหม
ได้
ถ้า FXServer ไม่ได้ Execute server.cfg
บรรทัด
sv_licenseKey "..."
ก็จะไม่ถูกอ่าน
ดังนั้น License Error อาจเป็นปัญหา Config Loading ไม่ใช่ Key เสีย
㉗ วิธีเช็ก Config ถูกตัว
ถ้ามีหลาย Server เช่น
Production
Development
Test
ตรวจว่า Server Instance กำลังใช้ server.cfg ของตัวไหน
ปัญหาที่พบบ่อยคือแก้ Key ใน Development Config แต่กำลังเปิด Production Config
㉘ Server Key กับ txAdmin Password ต่างกันอย่างไร
จำง่าย ๆ
Server Key
= ลงทะเบียน FXServer
txAdmin Password
= Login ระบบ Admin
ห้ามใช้เป็นสิ่งเดียวกัน
㉙ Server Key กับ Cfx Password ต่างกันอย่างไร
Cfx Password ใช้ Login Account
Server Key ใช้กับ Server Registration
ดังนั้นอย่า Copy Password Cfx ไปใส่
sv_licenseKey
㉚ Server Key กับ Steam Web API Key ต่างกันอย่างไร
สองอย่างเป็นคนละระบบ
Cfx Server Key
→ sv_licenseKey
ส่วน Vanilla Configuration ยังมีตัวเลือก
set steam_webApiKey ""
สำหรับ Steam Authentication ในกรณีที่ต้องใช้
อย่าสลับ Key กัน
㉛ Server Key กับ Port 30120 ต่างกันอย่างไร
Server Key
= Registration
30120
= Game Endpoint ที่นิยมใช้
Server Key ถูกต้องไม่ได้ช่วยเปิด Firewall หรือแก้ Port
Network ยังต้องตั้งแยก
㉜ Server Key กับ Port 40120 ต่างกันอย่างไร
40120
= Default txAdmin HTTP Port
ใช้เข้า Web Panel
ไม่เกี่ยวกับ Registration Key
ถ้า txAdmin เข้าไม่ได้ ไม่ควรสร้าง Server Key ใหม่เพื่อแก้
㉝ Server Key ต้องเป็นความลับไหม
ควรถือเป็นข้อมูลลับของ Server
ไม่ควรเผยแพร่ใน
Public GitHub
Discord สาธารณะ
Facebook
Forum
Screenshot
Video Description
ก่อนแชร์ Config ให้ปิดบัง Key เสมอ
㉞ วิธีปิดบัง Key ก่อนส่ง Config
แทน
sv_licenseKey "KEYจริง"
ด้วย
sv_licenseKey "REDACTED"
หรือ
sv_licenseKey "YOUR_SERVER_KEY"
แล้วจึงส่ง Config ให้ผู้อื่นตรวจ
㉟ server.cfg อาจมี Secret อื่นด้วย
นอกจาก Server Key อาจมี
Database Password
Discord Bot Token
API Key
Webhook Secret
RCON Password
ดังนั้นอย่าปิดบังเฉพาะ sv_licenseKey แล้วโพสต์ไฟล์ทั้งหมดทันที
ตรวจทั้งไฟล์ก่อน
㊱ อย่า Commit Key ลง Public GitHub
ตัวอย่างที่ไม่ควรทำ
sv_licenseKey "REAL_PRODUCTION_KEY"
ใน Public Repository
เพราะแม้ลบในภายหลัง ข้อมูลอาจเคยถูกบันทึกใน Git History แล้ว
แยก Secrets ออกจาก Public Source Code จะปลอดภัยกว่า
㊲ Key อยู่ใน Backup ด้วยไหม
ถ้า Backup server.cfg ทั้งไฟล์ Key ก็อยู่ใน Backup
ดังนั้น Backup ต้องได้รับการป้องกัน
ไม่ควรเก็บ Full Production Backup ไว้ใน Public Folder
㊳ Key หลุดควรทำอย่างไร
หากพบว่า Server Key ถูกเปิดเผย ให้เข้า Cfx Portal ตรวจ Registration ที่เกี่ยวข้องและจัดการ Credential ผ่านตัวเลือกปัจจุบันของ Portal
จากนั้นอัปเดต Configuration ที่ Server ใช้งาน
และตรวจว่าไฟล์หรือ Screenshot เดียวกันเปิดเผย Secret อื่นด้วยหรือไม่
㊴ ต้องสร้าง Key ใหม่ทุกครั้งที่ Restart Server ไหม
ไม่ต้อง
Restart FXServer ปกติไม่ได้ต้องการ Key ใหม่
Server จะอ่าน Registration Key จาก Configuration เดิมเมื่อ Start
㊵ Update Artifact ต้องสร้าง Key ใหม่ไหม
โดยทั่วไปการ Update FXServer Artifact ไม่ได้หมายความว่าต้องสร้าง Server Registration Key ใหม่
Workflow ปกติคือ
Backup
↓
Stop Server
↓
Update Artifact
↓
ใช้ Configuration เดิม
↓
Start Server
ถ้ามี License Error จึงค่อยตรวจ Portal และ Configuration
㊶ ย้าย VPS ต้องทำอะไรกับ Key
หลังย้ายควรตรวจ
Cfx Portal
Server Key
server.cfg
Public IP
Game Port
Firewall
txData
อย่าคิดว่าปัญหาหลังย้าย VPS มาจาก Key อย่างเดียว
Network และ Data Path เป็นอีกสองสาเหตุใหญ่
㊷ Server Key ถูกแต่เข้า Server ไม่ได้เกิดจากอะไร
ยังอาจเกิดจาก
Firewall
Port
Endpoint
NAT
CGNAT
Resource Error
Server Offline
Public IP ผิด
Server Key เป็นเพียงหนึ่งส่วนของระบบ
㊸ Server Key ถูกแต่ไม่ขึ้น Server List
ตรวจต่อที่
sv_lan
Endpoint
Firewall
Public Network
Server Visibility
Artifact
โดยเฉพาะถ้า
sv_lan true
Server จะเป็น LAN-only และไม่ปรากฏใน Public Server List
㊹ LAN-only มีข้อยกเว้นอะไร
Cfx.re ระบุว่าเมื่อ
sv_lan true
Server จะเป็น LAN-only และ License Key Checks จะถูก Skip
แต่ Server ออนไลน์ปกติควร Setup Registration Key ตามขั้นตอนมาตรฐาน
㊺ Server Key จำกัดจำนวน Player หรือไม่
Registration Key กับ Player Slot Limit เป็นคนละเรื่อง
ตัวอย่าง
sv_maxclients 48
มีข้อกำหนดของ OneSync และ Platform แยกต่างหาก
ดังนั้นมี Server Key ไม่ได้แปลว่าจะตั้งจำนวนผู้เล่นเท่าไรก็ได้โดยไม่มีเงื่อนไข
㊻ ถ้าใช้ Hosting ต้องสร้าง Key เองไหม
Cfx.re ระบุว่า Game Server Hosting Provider ต้องใช้ License Key ที่เชื่อมโยงกับ Cfx Account ของคุณกับ Server Instance
Hosting แต่ละรายอาจมีช่องให้กรอก Key ใน Control Panel
ควรใช้ Key ของ Account ที่คุณควบคุมเอง
㊼ ควรให้ Hosting สร้าง Keyแทนไหม
ถ้าระบบ Provider ต้องการ Key ของคุณ แนวทางที่ชัดเจนกว่าคือให้ Owner ควบคุม Cfx Account และ Registration เอง
จากนั้นนำ Credential ที่จำเป็นไปกำหนดกับ Server Instance ตามขั้นตอนของ Provider
ช่วยลดปัญหา Ownership เมื่อเปลี่ยน Hosting ในอนาคต
㊽ Checklist หลังสร้าง FiveM Server Key
ตรวจให้ครบ
Cfx Account ถูกบัญชี
เข้า Cfx Portal ได้
สร้าง Key สำเร็จ
Display Name ชัดเจน
Copy Key ถูกต้อง
ใส่ใน txAdmin/server.cfg ถูกตัว
sv_licenseKey ถูกต้อง
server.cfg ถูกโหลด
ไม่มี License Error
ไม่เผยแพร่ Key
Backup ถูกป้องกัน
Player ทดสอบเข้า Serverได้
㊾ วิธีสร้าง Key แบบแนะนำสำหรับ Production
ใช้โครงสร้างนี้
1. ใช้ Cfx Account ของ Owner
2. เข้า Cfx Portal
3. Create a key
4. ตั้งชื่อ PROJECT-PROD
5. Generate
6. Copy Key
7. ใส่ Production Config
8. ปิดบัง Key ในเอกสารที่แชร์
9. Start Server
10. ตรวจ Live Console
11. ทดสอบ Connection
12. บันทึกว่า Key นี้ใช้กับ Server ใด
ถ้ามี Development Server ให้แยกชื่อ Registration ให้ชัดเจน
㊿ สรุปวิธีสร้าง FiveM Server Key
ขั้นตอนสร้าง FiveM Server Key ปัจจุบันคือ
Cfx Account
↓
Cfx Portal
↓
Create a key
↓
Display Name
↓
GENERATE
↓
Copy
↓
txAdmin Recipe หรือ server.cfg
ถ้าใช้ server.cfg ให้ใส่
sv_licenseKey "YOUR_SERVER_KEY"
ถ้าใช้ txAdmin Recipe ให้สร้าง Key จาก Portal ในขั้น Input Parameters แล้วนำกลับมาวางก่อนกด Run Recipe
สำหรับ Production Server comsiam แนะนำให้ตั้ง Display Name ให้แยก Environment ชัดเจน เช่น
MYPROJECT-PROD
MYPROJECT-DEV
MYPROJECT-TEST
และให้ Cfx Account หลักอยู่ในการควบคุมของ Owner
อย่าโพสต์ Key จริงลง Public GitHub, Discord หรือ Screenshot และก่อนแชร์ server.cfg ต้องตรวจ Secret อื่น เช่น Database Password และ Tokens ด้วย
หาก FXServer แจ้งว่าไม่มี License Key อย่ารีบ Generate ใหม่ ให้ตรวจก่อนว่า server.cfg ถูกโหลดจริงหรือไม่ เพราะ Configuration ผิด Path หรือไม่ได้ Execute server.cfg ก็ทำให้ FXServer มองไม่เห็น Key ได้
เมื่อจัด Cfx Account, Portal Registration, sv_licenseKey และ Production Config อย่างเป็นระบบ ผู้ดูแล FiveM Server ของ comsiam จะสามารถสร้าง ย้าย และดูแล Server ได้ง่ายขึ้นโดยไม่สับสนว่า Key ใดเป็นของ Environment ใด
Comments
Post a Comment