x

บทหลัก

  1. LimeSurvey Cloud เทียบกับ LimeSurvey CE
  2. คู่มือเริ่มต้นใช้งานฉบับย่อ - LimeSurvey 3.0+
  3. การติดตั้ง - LimeSurvey CE
  4. วิธีออกแบบแบบสำรวจที่ดี (คู่มือ)
  5. เริ่มต้นใช้งาน
  6. การดูแลระบบ LimeSurvey
  7. แบบสำรวจ - บทนำ
  8. การตั้งค่าแบบสอบถาม
  9. เมนูสำรวจ
  10. โครงสร้างการสำรวจ
  11. คำถาม - บทนำ
  12. กลุ่มคำถาม - บทนำ
  13. แบบสำรวจ - การจัดการ
  14. ตัวเลือกแถบเครื่องมือแบบสำรวจ
  15. แบบสำรวจหลายภาษา
  16. ExpressionScript Engine - คู่มือเริ่มต้นอย่างรวดเร็ว
  17. ฟีเจอร์ขั้นสูงและฟีเจอร์ที่ไม่ได้จัดหมวดหมู่
  18. คำถามที่พบบ่อยทั่วไป
  19. การแก้ไขปัญหา
  20. วิธีแก้ปัญหาชั่วคราว (Workarounds)
  21. สัญญาอนุญาต
  22. บันทึกการเปลี่ยนแปลงของเวอร์ชัน
  23. ปลั๊กอิน
 Actions

ตัวอย่างการกำหนดค่า nginx สำหรับ LimeSurvey

From LimeSurvey Manual

หน้านี้อาจแปลด้วยเครื่องและอาจมีข้อผิดพลาด ดูต้นฉบับภาษาอังกฤษ · ปรับปรุงคำแปลนี้
This page is a translated version of the page LimeSurvey nginx example configuration and the translation is 100% complete.

ตัวอย่างการกำหนดค่า Nginx สำหรับ LimeSurvey

ด้านล่างนี้เป็นตัวอย่างการกำหนดค่าสำหรับการใช้งาน LimeSurvey ร่วมกับ nginx และ PHP-FPM โปรดปรับเส้นทาง ชื่อโดเมน และการตั้งค่าซ็อกเก็ต/พอร์ตของ PHP-FPM ให้ตรงกับการตั้งค่าเซิร์ฟเวอร์ของคุณ

หมายเหตุ: นี่เป็นเพียงตัวอย่างพื้นฐาน โปรดตรวจสอบและปรับแต่งให้เหมาะสมกับข้อกำหนดด้านความปลอดภัยของคุณก่อนนำไปใช้งานจริง

server {
    listen 80;
    server_name survey.example.com;
    # Redirect all HTTP traffic to HTTPS
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    server_name survey.example.com;

root /var/www/limesurvey;
    index index.php;

# SSL certificates
    ssl_certificate     /etc/ssl/certs/survey.example.com.crt;
    ssl_certificate_key /etc/ssl/private/survey.example.com.key;

# Recommended SSL settings
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers on;

client_max_body_size 100M;

access_log /var/log/nginx/limesurvey_access.log;
    error_log  /var/log/nginx/limesurvey_error.log;

location / {
        index  index.html index.php;
        try_files $uri $uri/ /index.php?$args;
    }

location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass unix:/run/php/php8.1-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }

# Deny access to hidden files and sensitive directories
    location ~ /\.(?!well-known).* {
        deny all;
    }

location ~ ^/tmp/runtime/ {
        deny  all;
    }
location ~* /(application|protected|modules|locale|framework|vendor|tests|docs|db|application/config)/ {
        deny all;
    }

# Disallow uploaded potential executable files in upload directory
location ~* /upload/.*\.(pl|cgi|py|pyc|pyo|phtml|sh|lua|php|php3|php4|php5|php6|pcgi|pcgi3|pcgi4|pcgi5|pcgi6|icn)$ {
        return 444;
    }

#Disallow direct read user upload files
location ~ ^/upload/surveys/.*/fu_[a-z0-9]*$ {
        return 444;
    }

location ~* \.(log|sql|htaccess)$ {
        deny all;
    }

# Allow LimeSurvey to serve uploaded files and assets
    location /upload/ {
        try_files $uri $uri/ =404;
    }
}

คำอธิบายคำสั่งสำคัญ

  • fastcgi_pass: ชี้ไปยังซ็อกเก็ตของ PHP-FPM หรือที่อยู่ TCP ที่ใช้รับคำขอ PHP โปรดอัปเดตให้ตรงกับการกำหนดค่า PHP-FPM pool ของคุณ
  • try_files: ช่วยให้ URL ถูกส่งต่อผ่าน front controller ของ LimeSurvey (index.php) อย่างถูกต้อง
  • client_max_body_size: เพิ่มขนาดการอัปโหลดสูงสุด ซึ่งมีประโยชน์สำหรับแบบสำรวจที่มีคำถามประเภทอัปโหลดไฟล์
  • กฎการปฏิเสธ (Deny rules): บล็อกการเข้าถึงไฟล์การกำหนดค่า บันทึก (log) และไดเรกทอรีของแอปพลิเคชันโดยตรงผ่านเว็บ ซึ่งไม่ควรเปิดให้เข้าถึงได้โดยสาธารณะ