LimeSurvey nginx 구성 예시
From LimeSurvey Manual
LimeSurvey용 Nginx 구성 예시
다음은 nginx와 PHP-FPM으로 LimeSurvey를 실행하기 위한 구성 예시입니다. 서버 환경에 맞게 경로, 도메인 이름, 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 요청을 처리하는 PHP-FPM 소켓 또는 TCP 주소를 지정합니다. 사용 중인 PHP-FPM 풀 구성에 맞게 수정하십시오.try_files: URL이 LimeSurvey의 프런트 컨트롤러(index.php)를 통해 올바르게 라우팅되도록 합니다.client_max_body_size: 최대 업로드 크기를 늘립니다. 파일 업로드 질문이 포함된 설문조사에 유용합니다.- 거부 규칙(Deny rules): 구성 파일, 로그, 애플리케이션 디렉터리 등 외부에 공개되어서는 안 되는 항목에 대한 직접적인 웹 접근을 차단합니다.