LoginSignup
7
5

More than 3 years have passed since last update.

PHP/Laravel5で本番環境リリース後にすること

Last updated at Posted at 2019-06-21

自分が、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
7
5
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
7
5