ubuntu server 14.04 安装symfony2

本文介绍如何更换Ubuntu系统的软件源为阿里云源,并通过Composer安装Symfony 2.8 LTS版本。此外,还提供了配置Apache VirtualHost的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

# 更换阿里云源

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak #备份
sudo vim /etc/apt/sources.list #修改
sudo apt-get update #更新列表

deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe

 

# 安装composer

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

php composer-setup.php

sudo mv composer.phar /usr/bin/composer

php -r "unlink('composer-setup.php');"

参考 https://getcomposer.org/download/

 

# 配置全量镜像

composer config -g repo.packagist composer https://packagist.phpcomposer.com

 

参考 http://pkg.phpcomposer.com/

 

# 安装symfony2

composer create-project symfony/framework-standard-edition=2.8.* my_project -vvv

ps: 这里安装了LTS版本的symfony

 

# 配置VirtualHost

1)复制一份/etc/apache2/sites-available/下的000-default.config重命名为your_project.conf.编辑这个文件为:

例如:

<VirtualHost *:80>

        ServerName ldev.www.yoursite.com

        ServerAlias ldev.yoursite.com

        DocumentRoot your_project/web

        <Directory your_project/web>

          Require all granted

          <IfModule mod_rewrite.c>

            Options -MultiViews

            RewriteEngine On

            RewriteCond %{REQUEST_FILENAME} !-f

            RewriteRule ^(.*)$ app.php [QSA,L]

          </IfModule>

        </Directory>

 

        ErrorLog ${APACHE_LOG_DIR}/error.log

        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

2) 保存文件,启用: sudo a2ensite your_project.conf

 

转载于:https://my.oschina.net/diablogatox/blog/548432

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值