[공지] SMS114.CO.KR 바로가기
www.sms114.co.kr
👉 텔레그램 상담 바로가기

2 분 소요

23-2. 코드이그나이터 설정

코드 이그나이트 3 을 download 받아서,

특정 경로에 다운로드,

  1. /var/www/html에 log 폴더만들고,

  2. codeIgnite 3 소스 부어 넣고,

  3. deprecated 없애고,

  4. switch (ENVIRONMENT)

    {

    case ‘development’:

    ​ //error_reporting(-1);

    ​ error_reporting(E_ALL & ~E_DEPRECATED);

  5. /application/config/config.php 열엉서, 아래 $config[base_url] 수정,

$config[‘base_url’] = ((isset($_SERVER[‘HTTPS’]) && $_SERVER[‘HTTPS’] == “on”) ? “https” : “http”); $config[‘base_url’] .= “://” . $_SERVER[‘HTTP_HOST’]; $config[‘base_url’] .= str_replace(basename($_SERVER[‘SCRIPT_NAME’]), “”, $_SERVER[‘SCRIPT_NAME’]);

$config[‘cookie_prefix’] = ‘log_’;

$config[‘cookie_domain’] = ‘.nurinet.biz’;

$config[‘cookie_path’] = ‘/’;

$config[‘cookie_secure’] = FALSE;

$config[‘cookie_httponly’] = FALSE;

$config[‘cookie_samesite’] = ‘Lax’;

/log 밑 .htaccess 파일 복붙

ExpiresActive on # Add Proper MIME-Type for Favicon AddType image/x-icon .ico "access plus 1 year" # Compress compressible fonts #AddOutputFilterByType DEFLATE font/ttf font/otf image/svg+xml # Add a far future Expires header for fonts ExpiresByType application/vnd.ms-fontobject "access plus 1 year" ExpiresByType font/ttf "access plus 1 year" ExpiresByType font/otf "access plus 1 year" ExpiresByType font/x-woff "access plus 1 year" ExpiresByType image/svg+xml "access plus 1 year" ExpiresByType image/x-icon "access plus 1 year" ExpiresByType image/jpg "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/gif "access plus 1 year" ExpiresByType image/png "access plus 1 year" ExpiresByType text/css "acces plus 1 month" ExpiresByType text/x-javascript "access plus 1 month" ExpiresByType application/x-shockwave-flash "access plus 1 month" ExpiresByType image/x-icon "access plus 1 year" ExpiresDefault "access plus 3 days" ExpiresByType application/pdf "access plus 0 seconds" # Web fonts ExpiresByType application/font-woff "access plus 1 month" ExpiresByType application/vnd.ms-fontobject "access plus 1 month" ExpiresByType application/x-font-ttf "access plus 1 month" ExpiresByType font/opentype "access plus 1 month" ExpiresByType image/svg+xml "access plus 1 month" # Data interchange ExpiresByType application/json "access plus 0 seconds" ExpiresByType application/xml "access plus 0 seconds" ExpiresByType text/xml "access plus 0 seconds" # HTML components (HTCs) ExpiresByType text/x-component "access plus 1 month" # HTML ExpiresByType text/html "access plus 0 seconds" # JavaScript ExpiresByType application/javascript "access plus 1 year" # Manifest files ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds" ExpiresByType text/cache-manifest "access plus 0 seconds"

.htaccess file

RewriteEngine on RewriteBase / RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php/$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] #### www 제거 ##### RewriteCond %{HTTP_HOST} ^www\.(.+) [NC] RewriteRule ^(.*) http://%1/$1 [R=301,NE,L] #### www 자동 붙임 ##### #RewriteCond %{HTTP_HOST} ^domain\.com [NC] #RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R]

데이터 베이스 설정

HeidiSQL 접속 시, root 계정이 모든 권한을 갖도록 설정처리,

#> mysql -u root -p 

이후, 권한을 부여할 MariaDB 사용자 root 에게 권한을 부여

/*모든 권한에는 데이터베이스와 관련된 모든 작업(읽기, 쓰기, 삭제, 수정 등)을 실행할 수 있는 권한이 포함됩니다*/
/* ON *.*  << 첫번째 * 는 DATABASE, 두번째 * 는 TABLE */
$> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY "Phs()2024";

/* MariaDB의 권한 테이블(내부 캐시)을 즉시 다시 로드하도록 강제함. */
$> FLUSH PRIVILEGES;

database log_v 생성, utf8mb4_general_ci 로,

/log/application/config/database.php 에서

$db 설정.


$db['default'] = array(
	'dsn'	=> '',
	'hostname' => 'localhost',
	'username' => 'root',
	'password' => 'xxxxxx',
	'database' => 'log_v',
	'dbdriver' => 'mysqli',
	'dbprefix' => '',
	'pconnect' => FALSE,
	'db_debug' => (ENVIRONMENT !== 'production'),
	'cache_on' => FALSE,
	'cachedir' => '',
	'char_set' => 'utf8',
	'dbcollat' => 'utf8mb4_general_ci',
	'swap_pre' => '',
	'encrypt' => FALSE,
	'compress' => FALSE,
	'stricton' => FALSE,
	'failover' => array(),
	'save_queries' => TRUE
);

23-6. 사이트 구조와 기능

1. 사이트구조 = 페이지 = 컨트롤러 + 뷰 + ajax

메인, 피드, 사용자의 페이지, 글작성

2. 기능 = API = 컨트롤러 + 모델

회원가입, 로그인, 로그인체크, 글목록, 글작성, 글수정, 사용자조회

태그:

카테고리:

업데이트:

댓글남기기