티스토리 뷰
반응형
Laravel 프로젝트 생성 가이드
1. 기본 환경 설정
필요한 패키지 설치
bash
# PHP, Composer, Nginx 설치
sudo apt update
sudo apt install php8.2 php8.2-fpm php8.2-mysql php8.2-mbstring php8.2-xml php8.2-curl php8.2-zip unzip nginx
Composer 설치
bash
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
2. Laravel 프로젝트 생성
bash
# 프로젝트 생성
composer create-project laravel/laravel site
# 프로젝트 디렉토리로 이동
cd site
# 권한 설정
sudo chown -R www-data:www-data storage bootstrap/cache
sudo chmod -R 775 storage bootstrap/cache
3. Nginx 설정
/etc/nginx/sites-available/site
nginx
server {
listen 80;
server_name site.local;
root /var/www/site/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
Nginx 활성화
bash
sudo ln -s /etc/nginx/sites-available/site /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
4. 환경 설정
.env 파일 설정
env
APP_NAME=Site
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://site.local
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=site
DB_USERNAME=root
DB_PASSWORD=
키 생성
bash
php artisan key:generate
완료! 추가로 필요한 설정 있으면 말씀해주세요.
반응형
'laravel' 카테고리의 다른 글
| github 에서 서버로 CI/CD 자동배포 설정 (0) | 2025.10.10 |
|---|---|
| Git 연결 세팅 (0) | 2025.10.10 |
| laravel 프로젝트 생성시 Base table or view not found (0) | 2025.10.08 |
| Storage 심볼릭 링크 설정 (0) | 2025.10.08 |
| 저렵한 서버 호스팅 찾기 (0) | 2025.10.08 |
댓글
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 라라벨설정
- laravel
- 깃연동
- 의정부 삼계탕
- 깃허브자동배포
- thesunny
- Accessor
- 더서니
- github
- 민락골
- 신규생성
- nginx설정
- php신규생성
- 홈마뜻
- 라라벨
- ci/cd
- css
- citykid
- 캐시테이블
- 프로젝트생성
- 엔진엑스설정
- 홈마
- 서니
- 스크립트강좌
- 깃생성
- 스크립트기초
- 깃계정변경
- 깃자동배포
- 메서드호출
- 라라벨프로젝트
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
| 31 |
글 보관함
반응형