nginx에서 사이트 위치 설정

nginx에서 사이트 위치 설정

해결할 수 없는 아주 간단한 문제가 있습니다. 한동안 웹을 검색했지만 좋은 결과가 없었습니다.

CentOS에서 실행되는 nginx 서버에서 사이트의 기본 위치를 변경하고 싶습니다.

내 사이트 폴더의 위치는 html입니다.

nginx.conf 파일을 편집하여 다음과 같이 표시합니다.

worker_processes  1;

events {
   worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;
        }
    }
}

여기서버의 폴더 구조입니다.

나중에 서버가 다시 작성되었습니다.

서버의 IP 주소를 입력하면 여전히 nginx 기본 HTML 페이지가 표시됩니다.

해결책이 무엇인지 아시나요?

필요한 정보를 놓친 경우 알려주시기 바랍니다.

답변1

root절대 경로로 설정해야 하는데 html절대 경로처럼 보이지 않습니다.

전.

location / { root /root/html; index index.html index.htm; }

올바른 권한을 확인하세요.

답변2

default_server지시어 에 추가합니다 listen:

listen 80 default_server;

관련 정보