nginx ¿À·ù

   Á¶È¸ 12038   Ãßõ 0    

nginx 설치오류가 있어서, 재설치를 했습니다 (vm이 있으니 편하고 좋습니다...)

http://2cpu.co.kr/QnA/515624


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)

http://2cpu.co.kr/PDS/11340


/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와 다른 신세경이네요. -..-...

- to be continue -
ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.
±èÁ¦¿¬ 2016-03
¾Æ±î ´äº¯¿¡ ÀÖ´Â
fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
¸¦ ¾Æ·¡Ã³·³ Çغ¸¼¼¿ä.
fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
±×¸®°í nginx / php-fpm Àç½ÃÀÛ
vm»ý¼ºÈÄ centos7 ¼³Ä¡ÈÄ nginx, php7 ¸¸ ¼³Ä¡ÈÄ Å×½ºÆ® ÇÏ¿´½À´Ï´Ù.

[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
     
ȸ¿øK 2016-03
¾Æ·§ºÎºÐ°ú °°ÀÌ ¼öÁ¤ÇÏ´Ï µË´Ï´Ù.
°¨»çÇÕ´Ï´Ù^^

        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;
}
}
          
°¡±ÞÀû  php-fpmÀº unix socket domainÀ¸·Î ¿î¿µÇϽñ⠹ٶø´Ï´Ù.
tcp ³×Æ®¿öÅ© ½ºÅÃÀ» °ÅÃļ­ ¿¬°áÇϴ°ͺ¸´Ù´Â  ¼ÒÄÏÀ» ÅëÇؼ­ ¿¬°áÇÏ´Â °ÍÀÌ ¼º´É¸é¿¡¼­ ÁÁ½À´Ï´Ù.
               
ȸ¿øK 2016-03
sockÀ¸·Î ¹Ù²Ù±â À§Çؼ­, ¾Æ·¡¿Í °°ÀÌ Çß´õ´Ï ¿À·ù°¡ ³ª¿À³×¿ä.
/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"
/etc/opt/remi/php70/php-fpm.d/www.conf¿¡ º¸½Ã¸é listen.owner¿Í listen.group , ±×¸®°í ±ÇÇÑÀΰ¡ 3ÁÙÀÌ ÁÖ¼®Ã³¸® µÇ¾îÀÖ½À´Ï´Ù.

ÇØÁ¦ÇØÁֽɵ˴ϴÙ. ÆùÀ¸·Î ±ÛÀ» ½á¾ßµÇ¼­ ¼³Á¤È­ÀÏÀ» º¼¼ö°¡ ¾ø¾î¼­ .....
     
ȸ¿øK 2016-03
±ÇÇѹ®Á¦³×¿ä. °¨»çÇÕ´Ï´Ù.
listen = /tmp/php5-fpm.sock //À§Ä¡´Â Àû´çÇÑ °÷À¸·Î
listen.owner = nginx
listen.group = nginx

º¯°æÇÏ½Ã°í  php-fpmÀç½ÃÀÛ ÇØÁÖ½Ã¸é µË´Ï´Ù. nginx confµµ
fastcgi_pass 127.0.0.1:9000 => fastcgi_pass unix:/tmp/php5-fpm.sock
·Î º¯°æÇØÁÖ½Ã¸é µÇ±¸¿ä.
     
ȸ¿øK 2016-03
°¨»çÇÕ´Ï´Ù.
ÁÖ¼®À» ÇØÁ¦ÇÏ°í, owner¸¦ ¹Ù²Ù´Ï µÇ³×¿ä.
±¸±ÛÀ» Çѽð£Âë ºÃ´Âµ¥, owner ¹Ù²Ù´Â °ÍÀº ¾ø´õ¶ó±¸¿ä. -..-...
          
php7 ¼º´ÉÀ̳ª ±âÁ¸ 5.x ÇÏ°íÀÇ È£È¯¼ºÀº ¾î¶»½À´Ï±î?
¾ÆÁ÷ php5.3 ¿¡¼­ ¸Ó¹°·¯ Àִµ¥ EOL µÈÁö ¿À·¡µÅ¼­ ½½½½ ÀÌÀüÇØ¾ß µÇÁö ¾ÊÀ»±î °í·ÁÁßÀ̰ŵç¿ä..
               
ȸ¿øK 2016-03
5.3.x.¿Í ±× ÀÌÈĹöÁ¯Àº Â÷ÀÌ°¡ ¾öû ³³´Ï´Ù.
phpÀÇ mysql api°¡ ¾ø¾îÁö°í, pdo ¾Æ´Ï¸é mysqli¸¦ ½á¾ß Çϱ¸¿ä.
¸ÇÁ¤½Å¿¡´Â ¼öÁ¤Çϱ⠾î·Á¿ï °Ì´Ï´Ù. -..-...

5.7·Î ¿Å±â¸é¼­ ³¯ÅÞÀÌ php¿¡¼­ ¶ó¶óº§ ÇÁ·¹ÀÓ¿÷À¸·Î ¹Ù²Ù·Á°í ÇÕ´Ï´Ù.


QnA
Á¦¸ñPage 2429/5678
2015-12   1477818   ¹é¸Þ°¡
2014-05   4940957   Á¤ÀºÁØ1
2017-12   4608   »Ú»ß
2019-04   4608   ¿À¼Ò¸®
2020-11   4608   ±îÄ¡»ê°³²ÜÅÊ
2014-02   4608   judeivan
2016-10   4608   ´Þ¸±±î
2007-02   4608   À±È£¿ë
2016-05   4608   sw123
2005-12   4608   ±èÀå¿ø
2014-07   4608   Æĸ®´ë¿Õ
2012-03   4608   ¹Ì¼ö¸Ç
2012-12   4608   ·Î±×¾Æ¿ô
2007-02   4608   À弮ȯ
2020-02   4608   audacity
2019-03   4608   ºò³Ê±¼¸Ç
2007-03   4608   °­µ¿¿À
2015-01   4608   ÇÑ°¡¶÷µ¹ÀÌ
2008-08   4608   ¹æÈ¿¹®
2006-11   4609   ³ëÇϼ®
2018-03   4609   Sikieiki
2007-07   4609   ±è½Â¿ë