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,以及如何创建依赖等.那么在这一篇中,我们就试图搭建一个生产级的解决方案,大家可以使用这个解决方案作为骨架代码来搭建自己的开发环境. 在这里,我们要完成 ...
随机推荐
- IEnumerable和IQueryable的区别以及背后的ExpressionTree表达式树
关于IEnumerable和IQueryable的区别,这事还要从泛型委托Func<T>说起.来看一个简单的泛型委托例子: class Program { static void Main ...
- mysql time zone时区的错误解决
错误提示: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zon ...
- CATransition 实践
时间差不够,导致闪屏 CATransition *animation = [CATransition animation]; animation.delegate = self; animation. ...
- UITableView分割线样式与颜色
tv.separatorStyle = UITableViewCellSeparatorStyleSingleLine; //设置样式 tv.separatorColor = [UIColor c ...
- 为python安装matplotlib模块
matplotlib是python中强大的画图模块. 首先确保已经安装python,然后用pip来安装matplotlib模块. 进入到cmd窗口下,执行python -m pip install - ...
- Library drmframework_jni not found
http://piotrbuda.eu/2012/06/trying-to-solve-error-491-in-play-store-on-android-emulator.html http:// ...
- .Net Core中文编码问题整理
1..Net Core Console控制台程序 在.Net Core中默认System.Text中不支持CodePagesEncodingProvider.Instance, System.Text ...
- 解决EditPlus在设置了UTF-8之后,编写的HTML页面仍出现汉字乱码问题
解决EditPlus在设置了UTF-8之后.编写的HTML页面仍出现汉字乱码问题 相信有些同学在使用EditPlus编写HTML页面时发现,尽管已经设置好了UTF-8的编码格式.但却发现HTML页 ...
- [转]nodejs深入学(7)理解Buffer
原文: https://www.jianshu.com/p/e3f14cdf78f1 --------------------------------------------------------- ...
- Java-JUC(二):Java内存模型可见性、原子性、有序性及volatile具有特性
1.Java HotSpot JVM运行时数据区 Java内存模型即Java Memory Model,简称JMM.JMM定义了Java 虚拟机(JVM)在计算机内存(RAM)中的工作方式.JVM是整 ...