自分が、Laravelでローカル環境から本番環境にコピーした後、特に忘れがちなことをメモ。
各々の環境や開発ポリシーで、大きく違うところもあるかと思うので、あくまで参考程度にして下さい。
パーミッション設定
cd /var/www/html/example
chown -R <user>:apache .
find . -type d -exec chmod 750 {} \;
find . -type f -exec chmod 640 {} \;
chmod -R 770 ./storage ./bootstrap/cache
Apache設定
/etc/httpd/conf.d/example.conf
Alias /example /var/www/html/example/public/
<Directory "/var/www/html/example/public">
AllowOverride All
Require all granted
</Directory>
htaccess設定
public/.htaccess
RewriteEngine On
RewriteBase /example
PHP
のビルトインサーバで開発していると忘れがち。
.env の修正 もしくは .env.production への差し替え
.env
APP_ENV=production
APP_DEBUG=false
.env のAPP_KEY更新
php artisan key:generate
オートローダー最適化
composer install --optimize-autoloader --no-dev
キャッシュ最適化
php artisan config:cache
php artisan route:cache