기본사이트

명시적으로 지정하지 않은 모든 호스트에 대해 연결할 위치를 지정합니다. 이것을 서버의 기본사이트라고 부릅니다.


server {
    listen       80 default_server;
    server_name  localhost;
    root   /usr/share/nginx/html;

    location / {
        index  index.php index.html;
    }

    location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        if (!-f $document_root$fastcgi_script_name) {
            return 404;
        }

        fastcgi_pass unix:/var/run/php-fpm/www.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }
}