Opensource

ci4 설정

KK_Ryong 2023. 11. 29. 14:56

#아파치 설정
sudo yum install httpd -y

vi /etc/httpd/conf.modules.d/00-mpm.conf
LoadModule mpm_worker_module modules/mod_mpm_worker.so

sudo systemctl start httpd
sudo systemctl enable httpd

apachectl -V | grep MPM (worker 인지 확인) (굳이 워커로 변경 안해도 됨)

#php 설정
sudo amazon-linux-extras install php7.4 -y
sudo amazon-linux-extras enable php7.4 -y
sudo yum install  php-cli php-common php-gd php-mbstring  php-mysqlnd php-pdo php-fpm php-xml php-opcache php-zip php-bcmath php-intl -y

#CI4 설정
mkdir ci4
cd ci4
wget https://github.com/codeigniter4/framework/archive/refs/tags/v4.3.6.tar.gz
tar -xvf v4.3.6.tar.gz
cd framework-4.3.6/
mv * ..
cd ..
rm -fr framework-4.3.6/
sudo chmod -R 777 writable
cd ..
chown -R ec2-user:ec2-user ci4
(상위 폴더들이 755인지 확인) (/home/ec2-user)


mv /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf_back
/etc/httpd/conf/httpd.conf 를 설치한 ci4 로 적용

(httpd_conf 적용)

----------------------------------------------------------------------------------------------------------

httpd.conf

기존 /etc/httpd/conf/httpd.conf 백업 한 뒤 삭제

 

echo -e '
ServerRoot "/etc/httpd"

Listen 80

Include conf.modules.d/*.conf

User apache
Group apache

ServerAdmin root@localhost

<Directory />
    AllowOverride none
    Require all denied
</Directory>

#DocumentRoot "/var/www/html/ci4/public"
DocumentRoot "/home/ec2-user/ci4/public"

#
# Relax access to content within /var/www.
#
#<Directory "/var/www">
<Directory "/home/ec2-user/ci4">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

# Further relax access to the default document root:
#<Directory "/var/www/html">
<Directory "/home/ec2-user">
    Options Indexes FollowSymLinks

    AllowOverride None

    Require all granted
</Directory>
#<Directory /var/www/html/ci4/public>
<Directory /home/ec2-user/ci4/public>
        Require all granted

        SetEnv ENV prd
        RewriteEngine On
        RewriteBase /
        RewriteCond $1 !^(index\.php|images|captcha|data|include|uploads|node_modules|helper|robots\.txt)
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php?/$1 [L]
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
<Files ".ht*">
    Require all denied
</Files>

ErrorLog "logs/error_log"

LogLevel warn

<IfModule log_config_module>

    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    CustomLog "logs/access_log" combined
</IfModule>

<IfModule alias_module>
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

</IfModule>

<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>

<IfModule mime_module>

    TypesConfig /etc/mime.types

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>

AddDefaultCharset UTF-8

<IfModule mime_magic_module>
    MIMEMagicFile conf/magic
</IfModule>

EnableSendfile on


<IfModule mod_http2.c>
    Protocols h2 h2c http/1.1
</IfModule>


IncludeOptional conf.d/*.conf

' >> /etc/httpd/conf/httpd.conf

systemctl start httpd
systemctl enable httpd

'Opensource' 카테고리의 다른 글

ActiveMQ 설치  (0) 2024.01.30
thumbor docker yml  (0) 2024.01.15
Mysql_MSR  (1) 2023.11.21
jenkins ssh 명령어  (0) 2023.09.05
Matrix Synapse RDS postgre 연동  (0) 2023.09.04