방금 우분투 12.04 LTS에 nginx를 설치했습니다. localhost에 액세스하면 다음이 제공됩니다.
500 내부 서버 오류 nginx/1.2.3
error_log에는 다음이 있습니다
내부적으로 "/index.html", 클라이언트: 127.0.0.1, 서버: localhost, 요청: "GET / HTTP/1.1", 호스트: "localhost"로 리디렉션하는 동안 재작성 또는 내부 리디렉션 주기
이는 기본 nginx 구성입니다. nginx.conf에는 다음이 포함됩니다.
include /etc/nginx/sites-enabled/*;
/etc/nginx/sites-enabled/default는 다음과 같습니다
root /usr/share/nginx/www;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
답변1
Nginx는 기본 사이트 이름을 www에서 html로 직접 변경했습니다.
루트 /usr/share/nginx/www;
다음으로 변경되어야 합니다.
루트 /usr/share/nginx/html;
답변2
이 간단한 구성에는 위치 블록과 try_files가 전혀 필요하지 않습니다.