Help us understand the problem. What is going on with this article?

メモ用:Laravel構築

More than 1 year has passed since last update.

環境

  • CentOS 7.3 (最小構成)
  • nginx 1.12
  • PHP 7.1
  • MariaDB 5.5
  • Laravel 5.4.21

リポジトリ追加

EPEL
yum install -y epel-release
Remi
yum install -y http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
nginx
yum install -y http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

PHP version 7.1 有効化

yum install yum-utils
yum-config-manager --enable remi
yum-config-manager --enable remi-php71

インストール

  • nginx
console
yum install -y nginx
  • PHP
console
yum install -y php php-mbstring php-pear php-fpm php-mcrypt php-mysql php71-php-fpm php71-php-mysqlnd php71-php-mcrypt php71-php-mbstring php71-php-gd
  • MariaDB
console
yum install -y mariadb mariadb-server
  • git
console
yum install -y git
  • Composer
console
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

設定

PHP

# vi /etc/php-fpm.d/www.conf
user = nginx
group = nginx

listen = /var/run/php-fpm/php-fpm.sock
listen.owner = nginx
listen.group = nginx

自動起動

console
systemctl start php-fpm
systemctl enable php-fpm

Laravel

console
mkdir /var/www
cd /var/www/
composer create-project --prefer-dist laravel/laravel Test
chmod -R 777 /var/www/Test/storage
chmod -R 777 /var/www/Test/bootstrap/cache

nginx

# vi /etc/nginx/conf.d/default.conf

server {
    listen       80;
    server_name  localhost;

    charset utf-8;
    root    /var/www/Test/public;
    index   index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php$query_string;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    location ~ \.php$ {
        fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    location ~ /\.ht {
        deny  all;
    }
}

自動起動

console
systemctl start nginx
systemctl enable nginx

MariDB

console
systemctl start mariadb
mysql_secure_installation 

自動起動

console
systemctl enable mariadb
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした