TP5 deployed to the cloud Ali
Installing System: ubuntu 16.04
Remote login via ssh server is configured as follows:
update list
apt-get update
to install language packs
sudo apt-get install -y language-pack-en-base
locale-gen en_US.UTF-8
install common software
sudo apt-get install -y vim git zip unzip
安装PHP7
// make sure that every step is not wrong, if there is an error, try to install more than a few times
sudo apt-get install -y software-properties-common
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
apt-cache search php7.1
sudo apt-get install -y php7.1
sudo apt-get install -y php7.1-mysql
sudo apt-get install -y php7.1-fpm
sudo apt-get install -y php7.1-curl php7.1-xml php7.1-mcrypt php7.1-json php7.1-gd php7.1-mbstring
安装 Mysql
sudo apt-get install -y mysql-server
// After installation you need to set a password
to install Nginx
// to be confirmed before the installation whether installed apache2, apache2 if already installed, you need to stop / unload apache2
// stop
sudo apache2 STOP Service
// unload
sudo APT-GET --purge the Remove apache2
sudo APT-GET --purge the Remove the Common-Apache2.2
sudo APT-GET autoremove
// install nginx
sudo apt-get install -y nginx
配置 PHP7
sudo vim /etc/php/7.1/fpm/php.ini
// modify cgi.fix_pathinfo = 0 Comment out!
sudo vim /etc/php/7.1/fpm/pool.d/www.conf
// listen = /var/run/php7.1-fpm.sock changes.
// modify listen = 9000
Configuration Nginx
Add your own in the directory server v /etc/nginx/conf.d file
, for example:
server {
# 监听端口号
listen 80;
# 服务器域名
server_name 你的域名;
# Web 服务的根目录
root 项目路径;
# 默认检索文件
index index.php index.html index.htm;
client_max_body_size 30M;
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
location ~ \.php(.*)$ {
# 语 法: fastcgi_pass fastcgi-server
# 默 认 值: none
# 使用字段: http, server, location
# 作 用: 指定fastcgi服务器监听端口与地址
fastcgi_pass 127.0.0.1:9000;
# 语 法: fastcgi_index file
# 默 认 值: none
# 使用字段: http, server, location
# 作 用: 如果URI以斜杠结尾,则将附加到URI并存储在变量$ fastcgi_script_name中的文件的名称
fastcgi_index index.php;
# 语 法: fastcgi_split_path_info regex
# 使用字段: location
# 可用版本: 0.7.31 以上
# 作 用: 指令允许为CGI specification 设置SCRIPT_FILENAME(SCRIPT_NAME) 和 PATH_INFO 变量
# a. 处理请求的脚本路径 - 对应 $fastcgi_script_name
# b. 脚本参数的值 - 对应 $fastcgi_path_info
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
# 语 法: fastcgi_param parameter value
# 默 认 值: none
# 使用字段: http, server, location
# 作 用: 该指令指定的参数, 将被传递给 FastCGI-server, 他可能使用字符串, 变量及其它们的组合来作为参数, 如果不在此制定参数, 它就会继承外层设置; 如果在此设置了参数, 将清除外层相关设置, 仅启用本层设置
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;
# 语 法: include file | *
# 默 认 值: none
# 使用字段: 任意位置
# 作 用: 使用 include 指令实现配置文件的包含
include fastcgi_params;
}
}
Access composer's official website to obtain the latest version of the following four lines of code, paste it directly perform the installation Composer
php -r “copy(‘https://getcomposer.org/installer’, ‘composer-setup.php’);”
php -r “if (hash_file(‘SHA384’, ‘composer-setup.php’) === ‘669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410’) { echo ‘Installer verified’; } else { echo ‘Installer corrupt’; unlink(‘composer-setup.php’); } echo PHP_EOL;”
php composer-setup.php
php -r “unlink(‘composer-setup.php’);”
// then move composer.phar
mv composer.phar / usr / local / bin / Composer
sudo chmod -R 777 / var / www / tp-project / runtime
restart PHP7 fpm and Nginx
service nginx restart
service php7.1-fpm restart