nginx 설치오류가 있어서, 재설치를 했습니다 (vm이 있으니 편하고 좋습니다...)
vm에 centos 7.2 minimal install을 했고, 다음과 같이LEMP를 설치했습니다.
nginx 설치 (1.9.x)
http://2cpu.co.kr/PDS/11338
mariadb 설치 (10.1.x)
http://www.2cpu.co.kr/PDS/11339
php 7 설치 (7.x)
/usr/share/nginx/html/index.php를 다음과 같이 만들고
echo phpinfo();
?>
그런후에 http://192.168.1.31/index.php 로 접속을 하니 오류가 나옵니다.
2016/03/21 15:47:49 [error] 1195#1195: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.1.17, server: localhost, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.1.31"
/etc/nginx/conf.d/default.conf 파일은 원본에서 fastcgi 쪽만 코멘트를 지웠습니다.
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$ {
#root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
델 R720에서와 다른 오류가 나옵니다. -..-...
google의 검색결과이구요. stackoverflow의 답을 적용해도 안됩니다.
https://www.google.co.kr/?gfe_rd=cr&ei=DprvVuHAGOjC8gem1IGACw#newwindow=1&q=FastCGI+sent+in+stderr:+%22Primary+script+unknown%22+while+reading+response+header+from+upstream
설치부터 apache와 다른 신세경이네요. -..-...
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
¸¦ ¾Æ·¡Ã³·³ Çغ¸¼¼¿ä.
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
±×¸®°í nginx / php-fpm Àç½ÃÀÛ
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=0
enabled=1
systemctl enable nginx
systemctl start nginx
yum -y install epel-release
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm -ivh ./remi-release-7.rpm
yum -y --enablerepo=epel,remi,remi-php70 install php70
source /opt/remi/php70/enable
yum -y --enablerepo=epel,remi,remi-php70 install php70-php-mcrypt php70-php-mbstring php70-php-fpm php70-php-gd php70-php-devel php70-php-mysqlnd php70-phpize
systemctl enable php70-php-fpm
systemctl start php70-php-fpm
nano /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
root /usr/share/nginx/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
}
nano /usr/share/nginx/html/info.php
<?php
phpinfo();
?>
systemctl restart php70-php-fpm
systemctl restart nginx
°¨»çÇÕ´Ï´Ù^^
root /usr/share/nginx/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
...
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
}
tcp ³×Æ®¿öÅ© ½ºÅÃÀ» °ÅÃļ ¿¬°áÇϴ°ͺ¸´Ù´Â ¼ÒÄÏÀ» ÅëÇؼ ¿¬°áÇÏ´Â °ÍÀÌ ¼º´É¸é¿¡¼ ÁÁ½À´Ï´Ù.
/etc/opt/remi/php70/php-fpm.d/www.conf¿¡¼ php70-php-fpmÀÇ »ç¿ëÀÚ/±×·ìÀº nginx·Î ¹Ù²å½À´Ï´Ù.
https://easyengine.io/tutorials/php/fpm-sysctl-tweaking/
2016/03/21 18:33:21 [crit] 1675#1675: *8 connect() to unix:/var/run/php70-php-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.1.17, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php70-php-fpm.sock:", host: "192.168.1.31"
ÇØÁ¦ÇØÁֽɵ˴ϴÙ. ÆùÀ¸·Î ±ÛÀ» ½á¾ßµÇ¼ ¼³Á¤ÈÀÏÀ» º¼¼ö°¡ ¾ø¾î¼ .....
listen.owner = nginx
listen.group = nginx
º¯°æÇϽðí php-fpmÀç½ÃÀÛ ÇØÁÖ½Ã¸é µË´Ï´Ù. nginx confµµ
fastcgi_pass 127.0.0.1:9000 => fastcgi_pass unix:/tmp/php5-fpm.sock
·Î º¯°æÇØÁÖ½Ã¸é µÇ±¸¿ä.
ÁÖ¼®À» ÇØÁ¦ÇÏ°í, owner¸¦ ¹Ù²Ù´Ï µÇ³×¿ä.
±¸±ÛÀ» Çѽð£Âë ºÃ´Âµ¥, owner ¹Ù²Ù´Â °ÍÀº ¾ø´õ¶ó±¸¿ä. -..-...
¾ÆÁ÷ php5.3 ¿¡¼ ¸Ó¹°·¯ Àִµ¥ EOL µÈÁö ¿À·¡µÅ¼ ½½½½ ÀÌÀüÇØ¾ß µÇÁö ¾ÊÀ»±î °í·ÁÁßÀ̰ŵç¿ä..
phpÀÇ mysql api°¡ ¾ø¾îÁö°í, pdo ¾Æ´Ï¸é mysqli¸¦ ½á¾ß Çϱ¸¿ä.
¸ÇÁ¤½Å¿¡´Â ¼öÁ¤Çϱ⠾î·Á¿ï °Ì´Ï´Ù. -..-...
5.7·Î ¿Å±â¸é¼ ³¯ÅÞÀÌ php¿¡¼ ¶ó¶óº§ ÇÁ·¹ÀÓ¿÷À¸·Î ¹Ù²Ù·Á°í ÇÕ´Ï´Ù.