似梦似醒

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

转载自 :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 查看运行状态

posted on 2017-07-05 09:19  人生如梦,梦如人生  阅读(172)  评论(0编辑  收藏  举报