Skip to content

Instantly share code, notes, and snippets.

@shohe05
Last active December 27, 2015 06:15
Show Gist options
  • Save shohe05/d36885065b6354be5053 to your computer and use it in GitHub Desktop.
Save shohe05/d36885065b6354be5053 to your computer and use it in GitHub Desktop.
CentOSにLaravel環境構築。0から。

最低限

$ yum install -y gcc make wget git zsh openssl-devel vim-enhanced

oh-my-zsh

$ chsh
/bin/zsh
$ curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh

php5.6

$ sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ sudo sed -i -e "s/enabled *= *1/enabled=0/g" /etc/yum.repos.d/epel.repo
$ sudo rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
$ sudo sed -i -e "s/enabled *= *1/enabled=0/g" /etc/yum.repos.d/remi.repo
$ sudo yum install -y php --enablerepo=epel --enablerepo=remi --enablerepo=remi-php56

php-xml

$ sudo yum install -y php-xml --enablerepo=epel --enablerepo=remi --enablerepo=remi-php56

php-mbstring

$ sudo yum install -y php-mbstring --enablerepo=epel --enablerepo=remi --enablerepo=remi-php56

php-mcrypt

$ sudo yum install -y php-mcrypt --enablerepo=epel --enablerepo=remi --enablerepo=remi-php56

php-mysql

$ sudo yum install -y php-mysql --enablerepo=epel --enablerepo=remi --enablerepo=remi-php56

php-opcache

$ sudo yum install -y php-opcache --enablerepo=epel --enablerepo=remi --enablerepo=remi-php56

xdebug

$ yum -y install php-pecl-xdebug --enablerepo=remi-php56

composer

$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/bin/composer

php-fpm

sudo yum install -y php-fpm --enablerepo=epel --enablerepo=remi --enablerepo=remi-php56

設定をnginx用に

- user = apache
+ user = nginx

- group = apache
+ group = nginx

nginx

$ sudo rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
$ sudo yum install -y nginx

nginxの設定ファイル

#laravelプロジェクト名をToDoとする

server {
    listen   80;
    server_name mylaravelenv.com;

    root   /vagrant/ToDo/public;
    index  index.html index.htm index.php;

    access_log /var/log/nginx/larabel_access.log;
    error_log /var/log/nginx/larabel_error.log;


    location / {
        try_files $uri $uri/ /index.php?q=$uri&$args;
    }


    location ~ \.php$ {
        try_files $uri =404; #phpファイルが見つからない場合は404
        include /etc/nginx/fastcgi_params;
        fastcgi_pass    127.0.0.1:9000;

    # Unixソケットを利用してFastCGIに渡す場合
    # fastcgi_pass unix:/path/to/socket_dir/php-fpm.sock;

        fastcgi_index   index.php;
        #fastcgi_split_path_info ^(.+\php)(/.+)$;

        # 以下はfastcgi_paramsファイルに直接記述してもOK
        fastcgi_param SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO         $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED   $document_root$fastcgi_path_info;
    }


    error_page      404 /index.php;

}

mysql

$ sudo yum install -y mysql-server mysql-devel
$ sudo chkconfig mysqld on

laravel

$ chown -R nginx:nginx storage

キュー使うなら

$ wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -ivh epel-release-6-8.noarch.rpm
$ yum install beanstalkd --enablerepo=epel
$ chkconfig beanstalkd on
$ service beanstalkd start

/etc/sysconfig/beanstalkd

- #BEANSTALKD_BINLOG_DIR=/var/lib/beanstalkd/binlog
+ BEANSTALKD_BINLOG_DIR=/var/lib/beanstalkd/binlog

参考

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment