티스토리 뷰

nginx 만 설치 한다고 php 소스를 볼 수 있는게 아니기 때문에
php 도 설치, 실행 해줘야 한다.

 

윈도우 환경에서 nginx 와 php 를 연동시켜 보자.

먼저 PHP를 다운받는다.
7버전이 제일 위에 있기 때문에 7버전을 받는다.
URL : http://windows.php.net/download

 

 

먼저 설치한 c:/nginx-1.8.1 에 압축을 해제 한다.
보기 좋게 php7폴더로 압축을 해제 했다.

 

 

Php-cgi.exe를 실행해줘야 하는데 포트를 설정해줘야 해서 커맨드 창에서 실행 한다.
이유는 아래 nginx 와 연동 설정에서 나온다.
cd /
cd nginx-1.8.1/php7
php-cgi.exe –d 127.0.0.1:9000

 

# MSVCR110.dll 이나 MSVCR~로 시작하는 에러 메시지가 난다면
https://support.microsoft.com/ko-kr/kb/2977003 여기서 Visual C++ 을 다운로드 받아준다. MSVCR11은 11버전 MSVCR15는 15버전.

c:nginx-1.8.1/html/ 밑에 index.php 파일을 하나 만들고 아래와 같은 내용을 넣어준다.
<? phpinfo(); ?>

 

 

c:nginx-1.8.1/conf/nginx.conf 파일을 열고 아래 부분을 수정한다.

43라인
location / {
root html;
#index index.html index.htm;
index index.html index.htm;
}

64라인
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME C:/nginx-1.8.1/html$fastcgi_script_name;
include fastcgi_params;
}

 

nginx.exe파일을 더블 클릭 하고
URL : http://localhost/index.php 로 가 보자.

 

 

끝.

 


댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함