0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Line BOTを触ったときのメモ

Posted at

line bot

概要

LineBotを触ることがあったので、その時のメモ
LineBot側の設定は、省略
とりあえず、環境づくり

LineBotは、Lineからの通信を受ける必要があったため、
サーバをネット上に公開が必要
それはできないので、ngrokを利用

環境

  • OS: centos
  • フレーム: Laravel

centos 初期設定

$ yum install epel-release
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
$ yum install -y wget bzip2-devel gcc gcc-c++ git autoconf vim rpmdevtools
$ ln -s /usr/lib64/libssl.so /usr/lib/libssl.so
$ yum update -y

php install

$ yum install --enablerepo=remi,remi-php71 php php-devel php-mbstring php-pdo php-gd php-xml php-mcrypt php-fpm
$ curl -sS https://getcomposer.org/installer | php
$ mv composer.phar /usr/local/bin/composer
$ cp /etc/php.ini /etc/php.ini.org
$ vi /etc/php.ini
---------------------------------
date.timezone = "Asia/Tokyo"
mbstring.language = Japanese
mbstring.internal_encoding = UTF-8
mbstring.http_input = UTF-8
mbstring.http_output = pass
mbstring.encoding_translation = On
mbstring.detect_order = auto
mbstring.substitute_character = none
---------------------------------


$ cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.conf.org
$ vi /etc/php-fpm.d/www.conf
---------------------------------
user = nginx
group = nginx
---------------------------------

nginx install

$ vi /etc/yum.repos.d/nginx.repo
---------------------------------
[nginx]

name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=0
enabled=1
----------------------------------


$ yum install nginx -y
$ systemctl enable nginx
$ systemctl start nginx

nginx laravel setup

server {
    listen       80;
    server_name  localhost;

    access_log  /var/log/nginx/linebot_access.log;
    error_log   /var/log/nginx/linebot_error.log;

    root /usr/share/nginx/linebot/projectname/public;

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

    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

ngrok install

$ cd /tmp
$ wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
$ unzip ngrok-stable-linux-amd64.zip
$ mv ngrok /usr/local/bin/
$ rm ngrok-stable-linux-amd64.zip
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?