网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

Linux中怎么安装Symfony2.8

这篇文章主要介绍Linux中怎么安装Symfony2.8,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

这篇文章主要介绍Linux中怎么安装Symfony2.8,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!Linux 安装 Symfony2.8

环境说明操作系统tony@ubuntu:~$ lsb_release -aNo LSB modules are available.Distributor ID: UbuntuDescription:    Ubuntu 14.04.2 LTSRelease:        14.04Codename:       trustySymfonysymfony2.8安装准备

创新互联建站于2013年开始,是专业互联网技术服务公司,拥有项目网站建设、网站制作网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元海州做网站,已为上家服务,为海州各地企业和个人服务,联系电话:18982081108

均使用 apt-get 安装

PHP5.4

至少要有个PHP5.4的环境

nginx

web server 是少不了了

安装步骤

1.下载官方命令工具

sudo curl -LsS https://symfony.com/installer -o /usr/local/bin/symfonysudo chmod a+x /usr/local/bin/symfony

2.创建项目

这里执行项目创建时,会从官网下载源码包,执行完后就能在当前目录看到了

symfony new symfony2.8 2.8

这里我创建了一个新的项目叫symfony2.8, 最后的2.8(不是项目名字中的2.8) 是要下载指定的symfony2.8版本的源码,如果要下载的是其他版本, 修改一下接口
3.检测

在安装完后, symfony还会进行一些检测, 看看你的操作系统环境是否适合运行symfony, 按照提示将缺失的扩展安装(我安装了intl)或者将PHP的配置修改(我就改了时区),再执行

php symfony2.8/bin/symfony_requirements

再次检测是否通过(php 后面的文件就在新创建的项目中,我这里项目名是symfony2.8)

运行

symfony2.8' 自带的console(位置symfony2.8/bin/console)可以临时启动一个webserver,默认端口是8000,启动后,通过http://localhost:8000` 就能看到他的欢迎页面了

nginx 配置

nginx 的配置其官方文档里也有, 这里直接把我的复制过来,我也是直接修改的官方文档

server {    listen 8028;    #server_name domain.tld www.domain.tld;    root /data/app/symfony2.8/web;    location / {        # try to serve file directly, fallback to app.php        try_files $uri /app.php$is_args$args;    }    # DEV    # This rule should only be placed on your development environment    # In production, don't include this and don't deploy app_dev.php or config.php    location ~ ^/(app_dev|config)\.php(/|$) {        fastcgi_pass 127.0.0.1:9000;        fastcgi_split_path_info ^(.+\.php)(/.*)$;        include fastcgi_params;        # When you are using symlinks to link the document root to the        # current version of your application, you should pass the real        # application path instead of the path to the symlink to PHP        # FPM.        # Otherwise, PHP's OPcache may not properly detect changes to        # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126        # for more information).        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;        fastcgi_param DOCUMENT_ROOT $realpath_root;    }    # PROD    location ~ ^/app\.php(/|$) {        fastcgi_pass unix:/var/run/php5-fpm.sock;        fastcgi_split_path_info ^(.+\.php)(/.*)$;        include fastcgi_params;        # When you are using symlinks to link the document root to the        # current version of your application, you should pass the real        # application path instead of the path to the symlink to PHP        # FPM.        # Otherwise, PHP's OPcache may not properly detect changes to        # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126        # for more information).        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;        fastcgi_param DOCUMENT_ROOT $realpath_root;        # Prevents URIs that include the front controller. This will 404:        # http://domain.tld/app.php/some-path        # Remove the internal directive to allow URIs like this        internal;    }    # return 404 for all other php files not matching the front controller    # this prevents access to other php files you don't want to be accessible.    location ~ \.php$ {      return 404;    }    error_log /data/log/nginx/symfony_error.log;    access_log /data/log/nginx/symfony_access.log;}

需要注意的是, nginx中包含了一个在开发环境适用的配置和一个在生产环境适用的配置,在生产华景部署的时候, 一定不要讲开发环境的配置带上去了

配置好后, 重新reload nginx,我这里监听的是虚拟机的8028端口,通过访问这个端口,也可以直接看到欢迎页面


当前标题:Linux中怎么安装Symfony2.8
本文URL:http://bjjierui.cn/article/icchsp.html

其他资讯