본문 바로가기
개발

CentOS Apache 환경에 Laravel 배포

by 솜씨제이 2024. 11. 15.

1. composer 설치

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

2. 필요한 경우 php 모듈 설치(dom)

yum install php-xml

3. composer 실행

php composer.phar install --optimize-autoloader --no-dev

4. npm nodejs 설치

yum install epel-release
yum install -y npm nodejs

5. npm 패키지 설치

npm install

6. Asset 번들

npm run build

7. 파일 시스템 권한

chmod -R 755 laravel-project
chmod -R 777 laravel-project/bootstrap/cache
chmod -R 777 laravel-project/storage

8. Apache 설정

<VirtualHost *:80>
    DocumentRoot "/var/www/laravel-project/public"
    ServerName laravel.example.com
     
    <Directory "/var/www/laravel-project/public">
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

9. Apache 재시작

apachestl restart

댓글