| 제목 | ubuntu16.04에 nginx + php7.0-fpm + mariadb10 구성중 질문드립니다! | ||
|---|---|---|---|
| 글쓴이 | Bill | 작성시각 | 2016/08/09 16:34:50 |
|
|
|||
|
현재 aws에서 1년 무료 호스팅을 이용하고있습니다. 운영체제환경은 amzn1 운영체제에 docker를 이용하여 ubuntu 16.04버전을 셋팅하였습니다. 책에 나와있는 내용을 바탕을 설치, 셋팅하였습니다.(버전은 차이가 있습니다.) nginx, php, mariadb의 버전은 다음과 같습니다. nginx version: nginx/1.11.3 PHP 7.0.9-1+deb.sury.org~xenial+1 (cli) ( NTS ) PHP 7.0.9-1+deb.sury.org~xenial+1 (fpm-fcgi) Server version: 10.0.25-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04
php 설정중 건드린것은 cgi.fix_pathinfo의 값을 0으로 바꿔주고 주석제거한 것 뿐입니다. nginx의 설정파일(/etc/nginx/conf.d/default.conf 의 내용은 다음과 같습니다. # /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
#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;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
root /usr/share/nginx/html;
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
(nginx, php-fpm7.0, mariadb 모두 서비스 running상태입니다.) 이 상태에서 웹root 경로에 접속하면 index.html의 내용(welcome to nginx)은 잘나옵니다. 하지만 .php파일은 404에러를 내면서 출력되지 않습니다.. apm서버구축 경험은 많지만 nginx는 처음이라 어느 부분이 잘 못됐는지 감이 안잡힙니다.. php-fpm이 설정이 잘못되었거나 제대로 실행이 되지 않는 것 같습니다. 혹시 저와 같은 경험을 하신 분이나 해결책을 아시는분의 도움을 부탁드립니다ㅠ |
|||
| 태그 | nginx,php7.0-fpm | ||
| 다음글 | 다음글 이전글 만들고 있습니다. (2) | ||
| 이전글 | 131쪽 입력 부분에서요.... (7) | ||
|
Bill
/
2016/08/09 17:34:08 /
추천
0
|
|
변종원(웅파)
/
2016/08/10 14:43:55 /
추천
0
|
자답입니다...
/etc/php/7.0/fpm/php.ini와
/etc/php/7.0/cli/php.ini 에서
cgi.fix_pathinfo의 값을 1로 바꾸니 .php파일이 정상적으로 나오네요.
책(33page)에서는 비정상적인 접근을 막기 위해 해당 값을 0으로 바꾸어준다고 했는데요,
저 같은 경우엔 그냥 1로 맞추고 해야하나요? 아님 다른 곳에 문제가 있는 걸까요?