1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

UbuntuのLAMP環境にLaravelをデプロイ

Posted at

UbuntuのLAMP環境にLaravelを公開することがあったので備忘録として残します。

環境

Ubuntu 18
Laravel6
php72
Apache2.4

手順

とりまアプデ
apt-get update
###1.Conposerをインスコ
curl -sS https://getcomposer.org/installer | php

apt install composer

##2.Laravelをインストール
composer create-project --prefer-dist laravel/laravel [project_name]

###3.Laravelをデプロイ
作成したプロジェクトディレクトリをApache Webルートに移動する

sudo mv example /var/www/html/
パーミッションの設定
sudo chgrp -R www-data /var/www/html/example/
sudo chmod -R 775 /var/www/html/example/storage
プロジェクトの新しいバーチャルホストを作成

cd /etc/apache2/sites-available

sudo nano laravel_project.conf

バーチャルホストのconfファイルに設定を記入

laravel_project.conf
<VirtualHost *:80>
   ServerName thedomain.com
   ServerAdmin webmaster@thedomain.com
   DocumentRoot /var/www/html/example/public

   <Directory /var/www/html/example>
       AllowOverride All
   </Directory>
   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

http.confも編集

http.conf
<Directory /var/www/html/>
  Options Indexes FollowSymLinks
  AllowOverride All
  Require all granted
</Directory>

作成したconfファイルを有効化
sudo a2ensite laravel_project

ApacheRewirteモジュールを有効にし、Apacheを再起動
sudo a2enmod rewrite
sudo systemctl restart apache2

こんな感じ

自分用の備忘録なので適当なのはあしからず

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?