zoukankan      html  css  js  c++  java
  • vagrant 虚拟机中安装 lnamp 环境

    转载自 :http://git.oschina.net/apanly/mooc/tree/master/vagrant

    • 替换源

      • sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak #备份
      • sudo vim /etc/apt/sources.list #修改源
      • sudo apt-get update #更新列表
    • L(A|N)MP

      • Ngnix

        • apt-cache search nginx     检查nginx是否存在
        • sudo apt-get install nginx
        • nginx -v

          nginx version: nginx/1.4.6 (Ubuntu)

        • 测试Nginx

          • curl -I 'http://127.0.0.1'

            HTTP/1.1 200 OK
            Server: nginx/1.4.6 (Ubuntu)
            Date: Sat, 07 Jan 2017 07:49:41 GMT
            Content-Type: text/html
            Content-Length: 612
            Last-Modified: Tue, 04 Mar 2014 11:46:45 GMT
            Connection: keep-alive
            ETag: "5315bd25-264"
            Accept-Ranges: bytes
            
      • Apache

        • sudo apt-get install apache2
        • apache2 -v

          Server version: Apache/2.4.7 (Ubuntu) Server built: Jul 15 2016 15:34:04

        • 测试访问,此时不能访问,因为80端口被nginx占用了,可以先把nginx停掉  sudo /etc/init.d/nginx stop    sudo /etc/init.d/apache2 start

          • curl -I 'http://127.0.0.1'

             HTTP/1.1 200 OK
             Date: Sat, 07 Jan 2017 08:15:26 GMT
             Server: Apache/2.4.7 (Ubuntu)
             Last-Modified: Sat, 07 Jan 2017 07:17:45 GMT
             ETag: "2cf6-5457bee51dd0d"
             Accept-Ranges: bytes
             Content-Length: 11510
             Vary: Accept-Encoding
             Content-Type: text/html`
            
        • 更改端口,将端口设置为8888

          • 修改 ports.conf 文件   /etc/apache2/
          • curl -I 'http://127.0.0.1:8888'

             HTTP/1.1 200 OK
             Date: Sat, 07 Jan 2017 08:24:15 GMT
             Server: Apache/2.4.7 (Ubuntu)
             Last-Modified: Sat, 07 Jan 2017 07:17:45 GMT
             ETag: "2cf6-5457bee51dd0d"
             Accept-Ranges: bytes
             Content-Length: 11510
             Vary: Accept-Encoding
             Content-Type: text/html`
            
      • Mysql

        • sudo apt-get install mysql-server #服务器端
          • 安装期间会提示输入为mysql设置root密码,我这边不操作,直接enter 不设置密码
        • sudo apt-get install mysql-client #客户端
          • mysql -uroot -p #测试连接库,上面安装服务端没有设置密码,这里直接enter进入
      • php

        • 安装php

          • sudo apt-get install php5-cli

            • php -v

                PHP 5.5.9-1ubuntu4.20 (cli) (built: Oct  3 2016 13:00:37)
                Copyright (c) 1997-2014 The PHP Group
                Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
                with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
              
        • PHP扩展       例:sudo apt-get install php5-mcrypt

          • php5-mcrypt
          • php5-mysql
          • php5-gd
        • 支持apache2的php模块

          • sudo apt-get install libapache2-mod-php5
          • 开启rewrite功能
            • sudo a2enmod rewrite
        • 支持nginx fastcgi

          • sudo apt-get install php5-cgi php5-fpm
          • 修改成9000端口 ,默认sock模式
            • cd /etc/php5/fpm/pool.d
            • sudo vim www.conf # search listen = 127.0.0.1:9000
            • sudo /etc/init.d/php5-fpm restart
    • 端口转发 为了验证nginx是否按照成功~~

    ps_ef |grep nginx 查看运行状态

  • 相关阅读:
    上班不再能上msn了
    小龟不用冬眠了
    Sonne学摄影(3)上海汽车展汽车
    新年提醒银行卡的用户注意了
    转贴:49届世乒赛海外名将介绍究竟谁会对中国队构成威胁??
    用两个词形容现在的生活:忙碌,充实
    终于加入胖友一族
    上海人
    相互残杀
    王励勤,好样的!看49届世乒赛男单决赛
  • 原文地址:https://www.cnblogs.com/zhaoyang-1989/p/7119521.html
Copyright © 2011-2022 走看看