예전에 Debian+Apache+PHP+CodeIgniter+MySQL 를 올린 적이 있다. 이번엔 CentOS에서 설치하는 법도 한 번 알아보도록 하자. DBMS 도 MySQL 이 아닌 PostgreSQL을 설치한다.
# yum groupinstall "Development Tools"
# yum install git htop ntp
사용자, DB 생성
# su - postgres
# psql
postgres=# CREATE USER 아이디 WITH PASSWORD '비밀번호';
postgres=# CREATE DATABASE 디비이름 WITH ENCODING='utf-8' OWNER 아이디;
계정으로 로그인할 수 있도록 연결설정
# su -
# cd /var/lib/pgsql/data/
# vi pg_hba.conf
모두 주석으로 막고 아래만 남김
host all all 0.0.0.0 0.0.0.0 password
local all postgres trust
local all all password
# vi postgresql.conf
listen_addresses = '*'
# /etc/init.d/postgresql restart
# psql -d 디비이름 -U 아이디 -W
$ mkdir -p /opt/project/프로젝트명/web
$ cd /opt/project/프로젝트명/web
# cd /etc/httpd/conf
# vi httpd.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerName 자신의도메인URL
DocumentRoot /opt/project/프로젝트명/web
<Directory />
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
# /etc/init.d/httpd restart
압축을 풀고 /opt/project/프로젝트명/web 에 업로드 한다.
/opt/project/프로젝트명/web 에.htaccess를 작성한다.
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
system/application/config/config.php 파일을 열어 기반url(base
URL)을 세팅한다.
$config['base_url'] = "자신의도메인URL";
데이터베이스를 사용한다면 application/config/database.php 파일을 열어서 데이터베이스 정보를 세팅한다.
$db['default']['hostname'] = "localhost";
$db['default']['username'] = "아이디";
$db['default']['password'] = "비밀번호";
$db['default']['database'] = "디비이름";
$db['default']['dbdriver'] = "postgre";
마지막으로 보안을 위해서 system 디렉토리를 sys로 변경하고, index.php 의 $system_folder 변수를 변경해준다.
$system_path = "sys";
sys 대신 자신이 원하는 다른 것으로 변경하길 바란다.
웹브라우저에서 자신의도메인URL 로 접속해본다.
댓글 없음:
댓글 쓰기