- RHEL/CentOS 7 에서 방화벽(firewalld) 설정하기
- CentOS 7 에서 PHP 7 설치하기
- CENTOS 7 PHP7 설치 방법 (NGINX 기준)
- How to Install PHP 7 NGINX & MySQL 5.6 on CentOS/RHEL 7.1 & 6.7
- How To Install Linux Nginx MySQL PHP (LEMP) stack On CentOS 7
- NGINX-php-MySQL 설치
- NGINX + php-FPM에서 502 BAD GATEWAY 에러 해결법 총정리
- 리눅스 php-mcrypt 설치
php7
yum install -y epel-release
yum update -y
rpm -ivh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum --enablerepo=remi update remi-release
yum --enablerepo=remi-php70 install -y php php-fpm php-mysql
yum --enablerepo=remi-php70 install -y php-mbstring php-common php-cli php-gd php-json php-devel php-imageic php-mcrypt php-xml php-xmlrpc php-soap php-bcmatch php-pear php-dba php-pdo php-ldap php-mysqlnd php-opcache
systemctl restart php-fpm
# mcrpyt 설치 여부 확인
php -r "mcrypt_create_iv();"
php -m | grep mcrypt
rpm -qa | grep mcrypt
yum list php-mcrypt
# 설치된 php 확인
yum list installed | grep php -i
php5.6 설치
yum install yum-utils
yum-config-manager --enable remi-php56
# disable 하지 않으면 enable 중 가장 최신 내용이 설치된다.
yum-config-manager --disable remi-php74
yum remove php*
yum install -y --enablerepo=remi,remi-php56 php php-bcmath php-cli php-common php-dba php-dbg php-devel php-embedded php-enchant php-fpm php-gd php-gmp php-imap php-interbase php-intl php-ldap php-litespeed php-mbstring php-mcrypt php-mysqlnd php-odbc php-opcache php-pdo php-pgsql php-process php-pspell php-recode php-snmp php-soap php-tidy php-xml php-xmlrpc
# 버전 확인
php -v
# php.ini 재 설정
vi /etc/php.ini
NGINX
yum install -y nginx
systemctl enable nginx.service
systemctl start nginx.service
/etc/nginx/fastcgi_params
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
set $fastcgi_script_realname $fastcgi_script_name;
set $path_info $fastcgi_path_info;
if ( $fastcgi_script_name ~ ^(.*\.php)(/.*)$ ) {
set $fastcgi_script_realname $1;
set $path_info $2;
}
if (!-f $document_root$fastcgi_script_realname) {
return 404;
}
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
/etc/php.ini
cgi.fix_pathinfo = 0
allow_url_fopen = On
expose_php = Off
display_errors = Off
date.timezone = Asia/Seoul
/etc/php-fpm.d/www.conf
user = nginx
group = nginx
listen.owner = nginx
listen.group = nginx // 앞에 주석 ; 을 지움
listen = /var/run/php-fpm/php-fpm.sock
/etc/nginx/conf.d/default.conf
파일이 없으면 추가한다.
혹은 site-avliable, site-enabled 폴더를 만들고 구분해서 사용한다.
server {
listen 80;
server_name _;
charset koi8-r;
access_log /var/log/nginx/log/_.access.log main;
root /usr/share/nginx/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
#location ~ /\.ht {
# deny all;
#}
}
SELinux Disabled
setenforce 0
vi /etc/sysconfig/selinux
;SELINUX=enforcing
SELINUX=disabled
Firewalld 설정
# 설치
yum install firewalld
systemctl start firewalld
systemctl enable firewalld
# 설정
vi /etc/firewalld/zones/public.xml
firewall-cmd --reload # 재시작
firewall-cmd --permanent --list-all # 파라미터로 등록된 서비스
/etc/firewalld/zones/public.xml
<?xml version="1.0" encoding="utf-8"?>
<zone>
<short>Public</short>
<description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accept
ed.</description>
<service name="dhcpv6-client"/>
<service name="http"/>
<service name="ssh"/>
<service name="https"/>
</zone>
반응형
'lang > php' 카테고리의 다른 글
PHP 병렬처리 (0) | 2017.03.17 |
---|---|
centos php-fpm session.save_handler redis setting (0) | 2017.03.02 |
php7.1 mcrypt_get_iv_size Error (0) | 2017.02.17 |
CI hwp 파일 업로드 (unknown file extension upload), 다운로드 (0) | 2016.07.02 |
PHP RedisClient Class (0) | 2016.06.07 |