ZH奶酪:LAMP环境中如何重新部署一个Yii2.0 web项目
使用Yii2.0 framework开发的项目,使用Github进行版本控制,现在要把这个项目部署到一个新的电脑/系统中:
(1)安装LAMP
(2)在/var/www/html目录下执行
git clone YOUR_YII_WEB_PROJECT
(3)cd Yii2.0 web项目(例如:mabuhay)目录,安装Yii2.0
zh@zh-VirtualBox:/var/www/html/mabuhay$ sudo curl -sS https://getcomposer.org/installer | php
zh@zh-VirtualBox:/var/www/html/mabuhay$ php composer.phar global require "fxp/composer-asset-plugin:~1.0.0"
zh@zh-VirtualBox:/var/www/html/mabuhay$ sudo php composer.phar install
(4)在/etc/apache2/sites-available目录下,新建并配置virtual host文件:mabuhay.conf:
<VirtualHost *:>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName localhost ServerAdmin webmaster@localhost
DocumentRoot "/var/www/html/mabuhay/web"
<Directory "/var/www/html/mabuhay/web">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
Allow from all
# ...other settings...
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost> # vim: syntax=apache ts= sw= sts= sr noet
(5)使virtual host文件生效
sudo a2ensite mabuhay.conf
(6)配置项目中的config目录下的db.php,指向本地db
(7)把db导入MySQL(可以使用MySQL workbench)
(8)安装相应php extension package,然后重启apache(service apache2 restart)
(9)在浏览器中可以打开这个项目,本例中的地址是localhost,因为在Virtual host文件中指定了:
ServerName localhost
ZH奶酪:LAMP环境中如何重新部署一个Yii2.0 web项目的更多相关文章
- linux日常---2、lamp.sh安装lamp环境中的linux操作
linux日常---2.lamp.sh安装lamp环境中的linux操作 一.总结 一句话总结: 学不如用,学一百遍还不如真正多用几遍的来的效果好 1.linux下查看进程命令? ps 常用 ps - ...
- lamp环境中的/到底是指的网站根目录还是linux的根
在lamp中经常会用到 require,require_once等包含文件的语句. 如果你使用相对路径没有问题. 但是如果你使用了这样的语句就要小心了. 对于如图网站目录 require_once ' ...
- anaconda环境中---py2.7下安装tf1.0 + py3.5下安装tf1.5
anaconda环境中---py2.7下安装tf1.0 + py3.5下安装tf1.5 @wp20181030 环境:ubuntu18.04, anaconda2, ubuntu系统下事先安装了pyt ...
- 在linux上部署自己开发的web项目
在linux上部署自己开发的web项目 前言:相信有很多做开发的小伙伴和我之前一样,只会在windows环境下,利用开发工具开发运行web项目,但是却不知道怎么把开发好的项目部署到linux服务器上去 ...
- Azure DevOps (十三) 通过Azure Devops部署一个Go的Web应用
前几篇文章中,我们分别实现通过azure来部署.NET和Springboot的应用,今天我们来研究一下如何部署一套Go的Web应用上去. 文章配套视频专栏: https://space.bilibil ...
- 企业运维 | MySQL关系型数据库在Docker与Kubernetes容器环境中快速搭建部署主从实践
[点击 关注「 WeiyiGeek」公众号 ] 设为「️ 星标」每天带你玩转网络安全运维.应用开发.物联网IOT学习! 希望各位看友[关注.点赞.评论.收藏.投币],助力每一个梦想. 本章目录 目录 ...
- Eclipse中使用Maven创建Servlet3.0 Web 项目
摘要 Apache Maven是一个优秀的项目构建和管理工具,许多开源项目都使用Maven进行构建.由于最近工作中要用到Maven,于是这里记录下在Eclipse中使用Maven插件创建一个基于Ser ...
- Web开发之tomcat配置及使用(环境变量设置及测试,一个简单的web应用实例)
Tomcat的配置及测试: 第一步:下载tomcat,然后解压到任意盘符 第二步:配置系统环境变量 tomcat解压到的D盘 (路径为: D:\tomcat), 配置环境变量: 启动tomcat需要两 ...
- Java全栈程序员之07:IDEA中使用MAVEN构架生产级的Web项目
在上一篇我们介绍了如何在IDEA中使用MAVEN,以及如何创建依赖等.那么在这一篇中,我们就试图搭建一个生产级的解决方案,大家可以使用这个解决方案作为骨架代码来搭建自己的开发环境. 在这里,我们要完成 ...
随机推荐
- 为在Windows Azure上的网站配置自定义域名
本篇体验给Windows Azure上的网站自定义域名,首先"CNAME"和"A记录"是必须了解的概念. 假设,在Windows Azure上的网站域名是:x. ...
- 认识TWICImage类
Graphics 单元新增了 TWICImage 类, 该类的功能源于新增的 Wincodec.pas 单元. WIC 支持的图像有 BMP.PNG.ICO.JPEG.GIF.TIFF.HDP(HDP ...
- 删除 AP 发票相关脚本
/* Formatted on 2018/3/15 10:33:14 (QP5 v5.256.13226.35538) */ --发票 CREATE TABLE bak.ap_invoices_all ...
- runOnUiThread更新主线程
更新UI采用Handle+Thread,需要发送消息,接受处理消息(在回调方法中处理),比较繁琐.除此之外,还可以使用runOnUiThread方法. 利用Activity.runOnUiThre ...
- 【LeetCode】- Length of Last Word(最后一个单词的长度)
[ 问题: ] Given a string s consists of upper/lower-case alphabets and empty space characters ' ', retu ...
- spring-boot:run启动时,指定spring.profiles.active
Maven启动指定Profile通过-P,如mvn spring-boot:run -Ptest,但这是Maven的Profile. 如果要指定spring-boot的spring.profiles. ...
- Button 自定义图片,代码绘制样式,添加音效的方法
Button自己在xml文件中绑定监听器 <!-- 设定onclick属性,然后在activity中定义相应的方法 --> <!-- 通过xml布局中通过button的android ...
- [Web 前端] 如何在React中做Ajax 请求?
cp from : https://segmentfault.com/a/1190000007564792 如何在React中做Ajax 请求? 首先:React本身没有独有的获取数据的方式.实际上, ...
- [Android Security] 如何把java代码转换成smali代码
copy :https://www.cnblogs.com/gordon0918/p/5466514.html 1.概述 Smali是Android系统中Dalvik虚拟机指令语言,在apk逆向过程中 ...
- Petri网
Petri网是一种适合于系统描述和分析的数学模型,主要描述异步和并发关系.(或者Petri网是对离散并行系统的数学表示,适用于描述异步的,并发的计算机系统模型.) Petri网模型自然,直观,简单易懂 ...