本次项目,使用virtual box安装,如果放到服务器上,请自行调整
centos
Mirror Download: http: //isoredirect.centos.org/centos/8/isos/x86_64/CentOS-8-x86_64-1905-dvd1.iso
Select .cn
version download.
First, the system installation chapter
1, virtual box
the operation is simple. The key part, please take a look at captions, partition recommendation: a hard disk 20G
or more memory 2G
or more.
2, the network and set the mouse, using a bridge (the LAN has its own ip
)
This step must be provided, or the mouse does not move back. Switching server and the local mouse, Mac
the computer press command+右键
. Windows
Computer-to-press ctrl
button.
3, select your downloaded centos
image file
4, select the first, to begin the installation
5, the production environment is recommended English, the presentation here, only with Chinese
6, the production environment, the less the software, the more stable the system. Select the minimum installation, be sure to check开发工具
7. Install Source, come in direct completion point on the line
8, the network can directly open
9, click to start the installation, enter two passwords, set their own
10, the installation is complete
Note: I did not cut a good shot here, regardless of the configuration information, follow the steps above normal configuration on the line.
11, after using the account password, execution ip addr
View ip
Address
Second, the installation lnmp articles
As used herein, a key packet lnmp, official website address http://lnmp.org/install.html
1, ssh
connected up, if the windows
use xshell
of the client.
2, execute the following command
#更新
yum -y update
#安装screen 与 wget
yum -y install screen #如果此命令执行报错,请重头再来
yum -y install wget
#下载安装lnmp一键包
wget http://soft.vpser.net/lnmp/lnmp1.5.tar.gz -cO lnmp1.5.tar.gz && tar zxf lnmp1.5.tar.gz && cd lnmp1.5
跑完上面的命令,需做如下操作:
增加`PHP`模块`fileinfo`选项,安装或升级时可以选择是否安装开启,选项在安装包目录下 `lnmp.conf` 中
vi lnmp.conf
`Enable_PHP_Fileinfo` 默认为 `n` 不开启,设置为 `y` ;
#接着执行下面的命令后
./install.sh lnmp
3, select the version you need to install software
I chose here mysql 5.7.22
and php7.2.6
(the latest version)
4, began the long process of compiling
press any key, start the compilation. The machine specific time, the common half an hour - about two hours (Reference: centos 7, Macbook pro 13 inch top section with the compiler 2015 about 1.5 hours).
The compilation process, try not to operate other operations consume computer resources. Do not move the computer is the best placed, let him run, otherwise it may cause the compiler to fail.
If the green appears completed! enjoy it
. Then congratulations to you, lnmp
the installation is complete.
If red appears, the report fails, please re-start it.
Some systems may have been stuck in Install lnmp V1.5 completed! enjoy it
. Do not automatically exit, press the Ctrl+c
exit.
Third, the project deployment articles (a) to ThinkPHP3.2 project as an example
1, add a virtual host
Note: I am here to demonstrate that online real domain name, the domain name if not the students, their own local virtual host configuration, refer to the following configuration:
If we own definition of a domain name that does not exist: xsystem.app
. The domain name is not real.
Then you need to set the client host
, this corresponds to a domain name server ip
up.
#如果你是mac机,在mac自己的终端中(不要搞到ssh连接的服务器上去了)执行
vim /etc/hosts
#在最底下加入
10.0.0.73 xsystem.app
#保存退出后,为确保正确,执行
ping xsystem.app
#如果出现服务器对应的ip地址,表示你已设置成功。
3, a test file is placed
back to the server terminal connected ssh
#进入自己的项目目录
cd /home/wwwroot/test.holyzq.com/
vi index.php
Writes the following:
<?php
echo "欢迎来到长乐教育学习!";
Save and exit, access on the client browser
If it can display properly, that you have no problem with the above configuration.
#删除刚才创建的index.php
rm index.php
4, upload database
Use sequel pro
or navicat
connect to the server MySQL
on
Note that the above account password, is MySQL
the. The following is the ssh
account password server login.
Then the new database, encoding settings, introducing item database, your own operation.
5, upload ThinkPHP3.2 project
Use filezilla
the sftp
connection to upload your project to /home/wwwroot/test.holyzq.com
the next folder
My personal habits, first compressed into a zip
file and upload it to the server /home/wwwroot/test.holyzq.com
under
#进入项目目录
cd /home/wwwroot/test.holyzq.com
#先解压缩
unzip chat.zip
#给权限,如果报错,不需要理它,实际上权限已给
chmod -R 777 wechat
6, modify the project's configuration database
cd /home/wwwroot/test.holyzq.com/wechat
#找到项目的数据库配置文件Config.php,更改数据库密码,保存退出。
7, modify nginx
configuration files
cd /usr/local/nginx/conf/vhost
vi test.holyzq.com.conf
Note: If Laravel
the root directory of the project in public
the next, so there must be configured on. ThinkPHP3.2
Items do not control.
#修改完成后,重启服务
lnmp restart
#如果重启失败,请尝试执行以下命令来检查错误。
nginx -t
8. At this time, accessed through a browser: test.holyzq.com
You will see the project can be a normal visit.
Fourth, the project deployment articles (B) to Laravel project as an example
1. Create a directory of the current project in accordance with the above process test.test
and configuration files test.test.conf
.
2, project packaging zip
, database export.
3, upper even filezilla
, as shown:
Then upload your project to /home/wwwroot/test.test
the next, upload, you will find no authority, then you will definitely go for permission, as shown:
Operating an impermissible figure appears, then, need to remove .user.ini
the hidden files, delete as follows:
cd /
cd lnmp1.5/tools
./remove_open_basedir_restriction.sh
LNMP 1.4
Or higher may be used as the installation package lnmp tools
under / directory ./remove_open_basedir_restriction.sh
for removal.
As shown, fill the item to delete the path below:
Upload again. Once uploaded by unzip ***
decompression, then give permission to execute the command:chmod -R 777 orange/
4, Sequel Pro
connected to the remote database, and import, as shown in FIG.
5, modifying Lavavel
the configuration database
cd /home/wwwroot/test.test
vi .env
6, modify Nginx
configuration files
cd /usr/local/nginx/conf/vhost
vi test.test.conf
lnmp restart
nginx -t
If the packet 500
error basis having processing steps, re-install PHP
. If it does not matter.
Last browser access:
I am here with the address of access, of course, can refer to the above steps configure the domain name.