Using a key installation package Centos 7 && lnmp (linux nginx mysql php) && TinkPHP3.2 project deployment project deployment && Laravel

本次项目,使用virtual box安装,如果放到服务器上,请自行调整

centos Mirror Download: http: //isoredirect.centos.org/centos/8/isos/x86_64/CentOS-8-x86_64-1905-dvd1.iso

Select .cnversion download.

First, the system installation chapter

1, virtual boxthe operation is simple. The key part, please take a look at captions, partition recommendation: a hard disk 20Gor more memory 2Gor 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, Macthe computer press command+右键. WindowsComputer-to-press ctrlbutton.

3, select your downloaded centosimage 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 addrView ipAddress

Second, the installation lnmp articles

As used herein, a key packet lnmp, official website address http://lnmp.org/install.html

1, sshconnected up, if the windowsuse xshellof 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.22and 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, lnmpthe 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+cexit.

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 ipup.

#如果你是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 proor navicatconnect to the server MySQLon

Note that the above account password, is MySQLthe. The following is the sshaccount password server login.

Then the new database, encoding settings, introducing item database, your own operation.

5, upload ThinkPHP3.2 project

Use filezillathe sftpconnection to upload your project to /home/wwwroot/test.holyzq.comthe next folder

My personal habits, first compressed into a zipfile and upload it to the server /home/wwwroot/test.holyzq.comunder

#进入项目目录
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 nginxconfiguration files

cd /usr/local/nginx/conf/vhost
vi test.holyzq.com.conf

Note: If Laravelthe root directory of the project in publicthe next, so there must be configured on. ThinkPHP3.2Items do not control.

#修改完成后,重启服务
lnmp restart
#如果重启失败,请尝试执行以下命令来检查错误。
nginx -t

8. At this time, accessed through a browser: test.holyzq.comYou 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.testand 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.testthe 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.inithe hidden files, delete as follows:

cd /
cd lnmp1.5/tools
./remove_open_basedir_restriction.sh

LNMP 1.4Or higher may be used as the installation package lnmp toolsunder / directory ./remove_open_basedir_restriction.shfor 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 Proconnected to the remote database, and import, as shown in FIG.

5, modifying Lavavelthe configuration database

cd /home/wwwroot/test.test
vi .env

6, modify Nginxconfiguration files

cd /usr/local/nginx/conf/vhost
vi test.test.conf

lnmp restart
nginx -t

If the packet 500error 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.

Published 14 original articles · won praise 1 · views 92

Guess you like

Origin blog.csdn.net/huangdj321/article/details/104929493