티스토리 뷰

Server

서버부터 세팅하자

YCPark 2017. 4. 6. 15:42

서버 세팅

Hello world! 한번 찍었으니


서버 부터 세팅하는 것이 순서라고 생각한다.


서버 OS는 CentOS 7을 사용하려 한다.

root 권한 부터 가지고 시작.

sudo su

yum update 한번 하고

yum update -y

PHP 7.1.3 설치

yum -y install epel-release

rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

yum --enablerepo=remi-php71 install php php-fpm php-gd php-mbstring php-mcrypt php-xml php-json php-mysql

php -v

PHP-fpm

--php-fpm 의 pool 설정(해당 부분만 수정했음)
vi /etc/php-fpm.d/www.conf
/ ************************************************************************ /
listen.owner = nginx
listen.group = nginx
user = nginx
group = nginx
/ ************************************************************************ /

--php-fpn 서비스 등록, 시작
systemctl enable php-fpm.service
systemctl start php-fpm.service

Nginx 1.10.3 설치

-- repo 작성
vi /etc/yum.repos.d/nginx.repo
/ ************************************************************************ /
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/x86_64/
gpgcheck=0
enabled=1
/ ************************************************************************ /

yum install nginx

-- Nginx 설정
vi /etc/nginx/conf.d/default.conf
/ ************************************************************************ /
server {
    listen       80 default;
    server_name  www.domain.com;

    root   /var/www/경로;
    index  index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    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 $uri/ /index.php;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        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;
    }
}
/ ************************************************************************ /

-- 서비스 등록, 시작
systemctl start nginx
systemctl enable nginx

MariaDB 10.1.10 설치

-- repo 작성
vi /etc/yum.repos.d/MariaDB.repo
/ ************************************************************************ /
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1.10/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
/ ************************************************************************ /

-- 키 생성
rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

-- 설치
yum install MariaDB-server MariaDB-client -y

-- 서비스 시작, 등록, root 암호 설정
systemctl start mysql.service
systemctl enable mysql.service

mysql_secure_installation

-- mysql time 설정
ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

-- mysql 접속
mysql -u root -p
use mysql

-- table 확인
show tables;

-- mysql user 생성 (외부 접속을 위해 '%'로 함)
create user 'user'@'%' identified by 'password';
grant all privileges on *.* to 'user'@'%';

완료.

'Server' 카테고리의 다른 글

AWS-ec2 PEM키 없이 Password 접속 사용자 생성  (0) 2017.06.09
나도 Git 한번 써보자  (0) 2017.04.18
SVN 설치  (0) 2017.04.18
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함