CentOSでLaravelアプリケーションを立ち上げるための前準備

CentOSでLaravelアプリケーションを立ち上げるための前準備

Laravel側の準備

key:generateを実行

$ php artisan key:generate
Application key set successfully.

パーミッションの変更

$ chmod -R 777 storage
$ chmod -R 777 bootstrap/cache

httpd.confの修正

rootになる

$ sudo -i

httpd.confをvimで開く

# vi /etc/httpd/conf/httpd.conf

DocumentRootを変更

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/html/chat/public"

下記2か所変更

<Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride NoneAll
    Require all granted
</Directory>

Aoache再起動

# systemctl restart httpd

SELinuxの無効化

$ getenforce
Enforcing

Enforcing となっている場合SELinuxが有効なので無効化する。

# vi /etc/selinux/config

下記を変更する

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabledenforcing

SELinuxを立ち上げなおし、

# shutdown -r now

Disabledになっていれば無効化完了。

$ getenforce
Disabled

ファイヤーウォールの無効化

[root@localhost ~]# systemctl stop firewalld

止まってることを確認

[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

再起動

# systemctl restart httpd