20170502_jeffrey - silenceuncrio/diary GitHub Wiki

0935

一早來 ariel 告知 dual sim 新的 UI 要怎麼做

相關的 proposal 在 Change SIM PIN

另外上禮拜 ariel 也提了 proposal - Network mode

這也是要做 UI

0945

先寫 engineering notebook

1015

上禮拜在 linode 上 安裝 Laravel(一個 PHP framework) 還沒成功

參考 Ubuntu 平台 laravel 安裝筆記 再裝一次

按照這篇文章安裝會出錯

因為我用的 ubuntu 16 沒有提供 php5 相關的 package

1115

看一下 給 Laravel 初學者的幾點建議

參考 Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x

1140

感謝 Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x

終於把 laravel 裝起來了

簡單記錄一下流程

Install PHP 7 on Ubuntu

Run the following commands in sequence.

sudo apt-get install -y language-pack-en-base
sudo apt-get update
sudo apt-get install zip unzip
sudo apt-get install -y php7.0 php7.0-fpm php7.0-mysql php7.0-zip php7.0-gd
sudo apt-get install nginx git

Important packages for Laravel

sudo apt-get install mcrypt php7.0-mcrypt
sudo apt-get install -y php7.0-mbstring php7.0-xml

Modify the PHP Configuration

Run the following command to go to php.ini

sudo vi /etc/php/7.0/fpm/php.ini

And uncomment and fix cgi.fix_pathinfo to

cgi.fix_pathinfo=0

Restart PHP 7.0 FPM

sudo service php7.0-fpm restart

Configure Nginx for Laravel

I am going to setup using a blank latest version of Laravel. This would installed in /var/www/laravel folder.

Run the following in terminal:

sudo mkdir -p /var/www/laravel

Next, we are going to modify the nginx's default configuration file: /etc/nginx/sites-available/default. But before that, just make a backup of the file:

sudo mkdir ~/Backups
sudo cp /etc/nginx/sites-available/default ~/Backups/default

Use the following command to edit the file

sudo vi /etc/nginx/sites-available/default

Next modify default from this:

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /usr/share/nginx/html;
        index index.html index.htm;

        server_name localhost;

        location / {
                try_files $uri $uri/ =404;
        }
}

to this:

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /var/www/laravel/public;
        index index.php index.html index.htm;

        # Make site accessible from http://localhost/
        server_name <Your Domain name / Public IP Address>;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ /index.php?$query_string;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }
        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}

Notice the difference:

  • try_files $uri $uri/ =404; has been changed to try_files $uri $uri/ /index.php?$query_string;
  • and location ~ .php$ { ... } block has been added.

Restart nginx.

sudo service nginx restart

If all was configured well, you'd see no error.

Install Composer and Laravel

Use the following commands to install composer and make it available across all folders.

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

Test by composer command to see if it was installed correctly.

Install laravel by using the following command.

sudo composer create-project laravel/laravel /var/www/laravel

Setting the permissions right for the Laravel folders.

sudo chown -R :www-data /var/www/laravel
sudo chmod -R 775 /var/www/laravel/storage

Finish

Check your site by http://server_domain_or_IP and it should show you "Laravel" homepage.

1305

回到 M300

參考 Network mode

來新增 LTE Config

1415

已參考 Network mode 完成 新增 LTE Config 的 需求

已上 code

1825

Ultimate Guide: Deploy Laravel 5.3 App on LEMP Stack (Ubuntu 16 and Nginx)

這一篇寫得非常詳細