edo1z blog

プログラミングなどに関するブログです

さくらVPSでcakephp3を動かす

環境

Ubuntu 16.04 PHP 7.0 Nginx 1.10

composerインストール+git clone

$ apt-get install composer
$ php -v
PHP 7.0.8-0ubuntu0.16.04.3 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.8-0ubuntu0.16.04.3, Copyright (c) 1999-2016, by Zend Technologies
$ apt-get update
$ apt-get install php7.0-intl
$ cd hoge.com
$ git clone hoge.git .
$ composer install

Nginx設定

$ vim /etc/nginx/sites-available/default

server {
        listen 443;
        ssl on;
        ssl_certificate /etc/letsencrypt/live/hoge.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/hoge.com/privkey.pem;
        server_name ~^c(?<no>\d+?)\.hoge\.com$;
        root /var/www/c/$no/webroot;
        index index.php;
        location / {
                try_files $uri $uri?$args $uri/ /index.php?$uri&amp;$args /index.php?$args;
        }
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        }
}