Results for tag "nginx"

Centos 7.x – Nginx+php-fpm+mariadb 설치

Mint™

언어 시간 설정

ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime

Centos 7 버전 확인 후 설치 진행

yum -y groupinstall "Development tools"
yum -y install epel-release
yum -y install wget

임시파일들 /usr/local/src 로 이동 후 다운로드 및 설치

cd /usr/local/src
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm && rpm -Uvh epel-release-7*.rpm
wget https://centos7.iuscommunity.org/ius-release.rpm && rpm -Uvh ius-release.rpm

Nginx 및 Php 5.6 관련 파일 설치

yum -y install nginx php56u php56u-devel php56u-fpm php56u-gd php56u-mbstring php56u-mcrypt php56u-mysql php56u-pdo php56u-opcache php56u-pear php56u-xml php56u-xmlrpc php56u-memcached mariadb mariadb-server mariadb-client vsftpd

Postfix 및 OpenSSL 설치

yum -y install postfix cyrus-sasl cyrus-sasl-plain cyrus-sasl-md5 cyrus-imapd postfix cyrus-sasl cyrus-sasl-plain cyrus-sasl-md5 cyrus-imapd openssl openssl-devel

방화벽 설치 및 설정

yum -y install firewalld
systemctl start firewalld
systemctl enable firewalld

firewall-cmd --permanent --direct --add-passthrough ipv4 -I INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 16 -j REJECT
firewall-cmd --permanent --add-icmp-block=echo-request
firewall-cmd --reload

MariaDB root 비밀번호 설정

mysql_secure_installation

/etc/my.cnf 설정

default-storage-engine = innodb
innodb_file_per_table = 1
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
max_allowed_packet = 268435456
open_files_limit = 51200

Nginx, php-fpm 설정

vi /etc/php-fpm.d/www.conf

listen = /var/run/php-fpm/php-fpm.sock

listen.owner = nginx
listen.group = nginx
listen.mode = 0660

user = nginx
group = nginx

pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35

php_value[session.save_handler] = files
php_value[session.save_path]    = /var/lib/php/session
php_value[soap.wsdl_cache_dir]  = /var/lib/php/wsdlcache
;php_admin_value[open_basedir] = /home/artg/html:/tmp
cd /var/lib/php
chown root.nginx *
chown nginx:root -R /var/log/php-fpm/
service nginx restart

Php 설정

vi /etc/php.ini

date.timezone = Asia/Seoul
expose_php = Off
max_execution_time = 180
max_input_time = 60
memory_limit = 256M
cgi.fix_pathinfo = 0
upload_max_filesize = 100M
post_max_size = 100M