Computer Science/Nginx

Nginx detail 페이지 접근시 404 Not Found error 해결

imygnam 2022. 8. 16. 23:22

nginx의 config 설정을 변경해주어야한다.

nginx의 default.config는 대부분

 

/etc/nginx/conf.d

 

에 있다.

 

들어가서

server {
    listen       80;
    server_name  localhost;

    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }

 

location 부분을

 

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
        try_files $uri $uri/ /index.html;
    }

 

try_files를 추가해준다.