php7环境下怎么部署phpthink3.0项目
确定服务器环境并配置服务器环境。根据ThinkPHPphp7部署信息查询显示:1、Phinkphp运行在PHP7环境下。
需要确保服务器上已安装PHP7环境,且版本符合要求。
同时,还需要安装数据库和Web服务器。
2、根据服务器的不同,需要进行相应的配置。
php项目怎么部署到服务器(php项目怎么部署到服务器中)
服务器配置?1配置ngnix多站点
?2.阿里云ecs目录结构;ngxin位于/etc/nginx/目录下,主要配置位置是nginx.config文件。
或者在conf.d中新建一个配置文件,添加到nginx.config文件中
?3.新建站点信息nginx.config
服务器{
listen?80;
server_name?www.yourdomainname.com;
站点的根相对路径;
indexindex.phpindex.htmlindex.htm;
#charsetkoi8-r;
#access_log?/var/log/nginx/host.access.log?main;
#Loadconfigurationfilesforthedefaultserverblock.
include/etc/nginx/default.d/*.conf;
位置/{
#try_files$uri$uri//index.php;
root?/opt/www/pcweb/ytyy_pc;
index?index.phpphpindex.htmlindex.htm;if(!-e$request_filename){?重写?^.*)$/index.php?s=$1?last;?break;}}?重写url(可选)
#redirectservererrorpagestothestaticpage/40x.html
#
error_page?404/404.html;?40错误页面配置
location=/40x.html{
}
#redirectservererrorpagestothestaticpage/50x.html
#
error_page?500502503504?/50x.html;?50错误页面配置
location=/50x.html{
}
location~\.php${
roott站点相对路径;
fastcgi_pass?127.0.0.1:9000;
fastcgi_index?index.php;
fastcgi_param?SCRIPT_FILENAME?$document_root$fast.
后端配置同上,公共配置。
关于组成的注释是相同的。
将前端dist文件下的php文件夹中的所有文件(包括.htaccess)放入其中。
将后台索引控制器的index方法的路径重定向到PHP下的index.html文件:
namespace?app\index\controller;
using?think\Controller;
class?index?extends?Controller
{
publicic?function?index()?{
$this-redirect('/index.html');
}
}
前端调用登录接口:this.axios.post('/index.php/base/login',{user:'',password:''})
转载自: