NginX 설정 질문좀 드릴께요. default 파일

NginX 설정 질문좀 드릴께요. default 파일

QA

NginX 설정 질문좀 드릴께요. default 파일

본문

안녕하세요. 초보입니다. 그누보드 설치 준비중에 LEMP를 구성하고 있습니다.



default 파일에 있는 서버블락 설정인데요 여기저기참고하다 보니 아래처럼 되었어요. 잘 동작중입니다.


location ~ \.php$ {

#try_files $uri =404;

include snippets/fastcgi-php.conf;

fastcgi_pass unix:/run/php/php7.0-fpm.sock;

#fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

}


근데 궁금한게 주석처리한 저 두 줄을 넣으면 신택스 에러가 나오더라고요


snippets/fastcgi-php.conf; 를 임포트하면서 중복된다고요.


그래서 snippets/fastcgi-php.conf; 의 파일을 봤는데 


아래쪽거 fastcgi_index index.php; 이거는 완전히 같은반면


 위에있는

#try_files $uri =404; 

이거는 

try_files $fastcgi_script_name =404; 

이렇게 되어있더라고요. 


이거 이렇게 다른데 상관 없을 까요?




아래는  snippets/fastcgi-php.conf; 파일의 내용입니다.



# regex to split $uri to $fastcgi_script_name and $fastcgi_path

fastcgi_split_path_info ^(.+\.php)(/.+)$;


# Check that the PHP script exists before passing it

try_files $fastcgi_script_name =404;


# Bypass the fact that try_files resets $fastcgi_path_info

# see: http://trac.nginx.org/nginx/ticket/321

set $path_info $fastcgi_path_info;

fastcgi_param PATH_INFO $path_info;


fastcgi_index index.php;

include fastcgi.conf;






이 질문에 댓글 쓰기 :

답변 1

제가 사용하는 서버의 환경파일입니다. 참고하세요.


server {
    listen       80;
    server_name  www.mydomain.com;
    charset utf-8;
    access_log  /var/log/nginx/www.mydomain.com.access.log  main;
    root   /usr/share/nginx/html;
 
    location / {
        index  index.php index.html index.htm;
        try_files $uri $uri/ /index.php?$args;
    }
 
    error_page  404              /404.html;
    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        root           /usr/share/nginx/html;
        try_files $uri =404;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  SCRIPT_NAME $fastcgi_script_name;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 256 16k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
        include        fastcgi_params;
    }
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
        deny  all;
    }
}
답변을 작성하시기 전에 로그인 해주세요.
전체 6
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT