v

一直是在用的lnmp的集成安装包搭建lnmp环境,因为工作需要需要安装ldap扩展,在网上怎么都找不到源码安装包,只能卸载掉原来的lnmp环境,用ubuntu的php5-ldap扩展,

在安装中遇到一些问题,网上的文章坑爹的比较多,写篇文章记录下来。

1.安装MySQL

  1. sudo apt-get install mysql-server mysql-client

安装过程中要输入root用户的密码。

我在安装中出错,是原来的mysql-cilent mysql-workbench 未完全卸载,将mysql组件完全卸载的方法:

删除mysql前 先删除一下 /var/lib/mysql 还有 /etc/mysql

  1. sudo rm /var/lib/mysql/ -R
  2. sudo rm /etc/mysql/ -R
  3. sudo apt-get autoremove mysql* --purge
  4. sudo apt-get remove apparmor

全部删除之后再执行  apt-get install mysql-server mysql -client

2.安装nginx

  1. sudo apt-get install nginx

3.安装成功后。我们重启下nginx服务

  1. sudo service nginx restart<span style="font-size: 16px; font-family: 'Microsoft Yahei', Arial, Helvetica, sans-serif;"> </span>

启动之后我们就可以访问以下我们的地址了。看能不能出现nginx的欢迎界面。

4.这里我们使用php5-fpm来作为我们的php解析。

  1. sudo apt-get install php5-fpm

5.接下来我们要修改一下nginx的站点配置了。

ngnix的配置文件存放在/etc/nginx/sites-availble/default

  1. server {
  2. listen   80; ## listen for ipv4; this line is default and implied
  3. listen   [::]:80 default ipv6only=on; ## listen for ipv6
  4. root /usr/share/nginx/www;
  5. index index.php index.html index.htm;
  6. # Make site accessible from http://localhost/
  7. server_name _;
  8. location / {
  9. # First attempt to serve request as file, then
  10. # as directory, then fall back to index.html
  11. try_files $uri $uri/ /index.html;
  12. }
  13. location /doc {
  14. root /usr/share;
  15. autoindex on;
  16. allow 127.0.0.1;
  17. deny all;
  18. }
  19. #error_page 404 /404.html;
  20. # redirect server error pages to the static page /50x.html
  21. #
  22. error_page 500 502 503 504 /50x.html;
  23. location = /50x.html {
  24. root /usr/share/nginx/www;
  25. }
  26. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  27. #
  28. #location ~ \.php$ {
  29. #       proxy_pass http://127.0.0.1;
  30. #}
  31. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  32. #
  33. location ~ \.php$ {
  34. try_files $uri =404;
  35. # With php5-cgi alone:
  36. # fastcgi_pass 127.0.0.1:9000;
  37. # With php5-fpm:
  38. # fastcgi_pass unix:/var/run/php5-fpm.sock;
  39. fastcgi_index index.php;
  40. include fastcgi_params;
  41. }
  42. # deny access to .htaccess files, if Apache's document root
  43. # concurs with nginx's one
  44. #
  45. location ~ /\.ht {
  46. deny all;
  47. }
  48. }

6.我们在安装php5相关的一些组件。

  1. sudo apt-cache search php5
  2. apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

7.重启服务

  1. sudo service php5-fpm restart
  2. sudo service nginx restart  

    一直是在用的lnmp的集成安装包搭建lnmp环境,因为工作需要需要安装ldap扩展,在网上怎么都找不到源码安装包,只能卸载掉原来的lnmp环境,用ubuntu的php5-ldap扩展,

    在安装中遇到一些问题,网上的文章坑爹的比较多,写篇文章记录下来。

    1.安装MySQL

    1. sudo apt-get install mysql-server mysql-client

    安装过程中要输入root用户的密码。

    我在安装中出错,是原来的mysql-cilent mysql-workbench 未完全卸载,将mysql组件完全卸载的方法:

    删除mysql前 先删除一下 /var/lib/mysql 还有 /etc/mysql

    1. sudo rm /var/lib/mysql/ -R
    2. sudo rm /etc/mysql/ -R
    3. sudo apt-get autoremove mysql* --purge
    4. sudo apt-get remove apparmor

    全部删除之后再执行  apt-get install mysql-server mysql -client

    2.安装nginx

    1. sudo apt-get install nginx

    3.安装成功后。我们重启下nginx服务

    1. sudo service nginx restart<span style="font-size: 16px; font-family: 'Microsoft Yahei', Arial, Helvetica, sans-serif;"> </span>
    
    

    启动之后我们就可以访问以下我们的地址了。看能不能出现nginx的欢迎界面。

    4.这里我们使用php5-fpm来作为我们的php解析。

    1. sudo apt-get install php5-fpm

    5.接下来我们要修改一下nginx的站点配置了。

    ngnix的配置文件存放在/etc/nginx/sites-availble/default

    1. server {
    2. listen   80; ## listen for ipv4; this line is default and implied
    3. listen   [::]:80 default ipv6only=on; ## listen for ipv6
    4. root /usr/share/nginx/www;
    5. index index.php index.html index.htm;
    6. # Make site accessible from http://localhost/
    7. server_name _;
    8. location / {
    9. # First attempt to serve request as file, then
    10. # as directory, then fall back to index.html
    11. try_files $uri $uri/ /index.html;
    12. }
    13. location /doc {
    14. root /usr/share;
    15. autoindex on;
    16. allow 127.0.0.1;
    17. deny all;
    18. }
    19. #error_page 404 /404.html;
    20. # redirect server error pages to the static page /50x.html
    21. #
    22. error_page 500 502 503 504 /50x.html;
    23. location = /50x.html {
    24. root /usr/share/nginx/www;
    25. }
    26. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    27. #
    28. #location ~ \.php$ {
    29. #       proxy_pass http://127.0.0.1;
    30. #}
    31. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    32. #
    33. location ~ \.php$ {
    34. try_files $uri =404;
    35. # With php5-cgi alone:
    36. # fastcgi_pass 127.0.0.1:9000;
    37. # With php5-fpm:
    38. # fastcgi_pass unix:/var/run/php5-fpm.sock;
    39. fastcgi_index index.php;
    40. include fastcgi_params;
    41. }
    42. # deny access to .htaccess files, if Apache's document root
    43. # concurs with nginx's one
    44. #
    45. location ~ /\.ht {
    46. deny all;
    47. }
    48. }

    6.我们在安装php5相关的一些组件。

    1. sudo apt-cache search php5
    2. apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
    
    

    7.重启服务

    1. sudo service php5-fpm restart
    2. sudo service nginx restart

ubuntu通过apt-get方式搭建lnmp环境以及php扩展安装的更多相关文章

  1. Centos7.2 下搭建LNMP环境(终极版)Yum安装

    PHP7.1+Nginx+MySQL5.7 安装PHP //安装源只要遇到选择的全是Y rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-rele ...

  2. Centos 7 下yum搭建lnmp环境(yum安装方式)

    我们都知道linux下安装软件主要有三种方式: 1.源码编译安装,即下载软件源代码,利用gcc g++ make 等编译工具进行编译安装: 此方式的优点:可以指定软件版本,可选择性好:编译时可以手动指 ...

  3. docker搭建lnmp环境(问题,资料,命令)

    入门参考 http://www.runoob.com/docker/docker-install-nginx.html 十大常用命令玩转docker 1. #从官网拉取镜像 docker pull & ...

  4. CentOS6.6搭建LNMP环境

    CentOS6.6搭建LNMP环境 1.设置yum源,本地安装依赖包 1 yum -y install gcc gcc-c++ automake autoconf libtool make 2.下载依 ...

  5. Yum搭建LNMP环境(动、静、库分离)(week4_day5)--技术流ken

    前言 本篇博客使用yum来搭建lnmp环境,将采用动态,静态以及数据库分开安装的方式即nginx,php,mysql.会被分开安装在不同的服务器之上,搭建出来一套lnmp环境,并部署wordpress ...

  6. [Linux] deepin15.8搭建LNMP环境

    LAMP和LNMP LAMP==Linux+Apache+Mysql+PHP LNMP==Linux+Nginx+Mysql+PHP 安装nginx sudo apt install nginx 安装 ...

  7. Mac下docker搭建lnmp环境 + redis + elasticsearch

    之前在windows下一直使用vagrant做开发, 团队里面也是各种开发环境,几个人也没有统一环境,各种上线都是人肉,偶尔还会有因为开发.测试.生产环境由于软件版本或者配置不一致产生的问题, 今年准 ...

  8. centos7 yum搭建lnmp环境及配置wordpress超详细教程

    yum安装lnmp环境是最方便,最快捷的一种方法.源码编译安装需要花费大量的人类时间,当然源码编译可以个性化配置一些其它功能.目前来说,yum安装基本满足我们搭建web服务器的需求. 本文是我根据近期 ...

  9. CentOS 7 源码搭建LNMP环境

    搭建 LNMP 环境 源码包版本 :  CentOS Linux  7 nginx-1.15.1.tar.gz  mysql-boost-5.7.21.tar.gz  php-7.2.7.tar.gz ...

随机推荐

  1. Go语言 异常panic和恢复recover用法

    Go语言 异常panic和恢复recover用法 背景:Go语言追求简洁优雅,所以,Go语言不支持传统的 try…catch…finally 这种异常,因为Go语言的设计者们认为,将异常与控制结构混在 ...

  2. linux 下c语言的pwd 实现

    20155211实现mypwd 关于pwd 在Linux层次结构中,用户可以在被授权的任意目录下利用mkdir命令创建新目录,也可以利用cd命令从一个目录转换到另一个目录.然而,没有提示符来告知用户目 ...

  3. 自己在UWP程序上调用usb转串口的路程

    之前一直是在普通的framework环境下写串口,使用的类为 SerialPort 这个类大家可能比较熟悉.但是在UWP的开发里,使用的是 SerialDevice 这个类,是不一样的. 1. 清单文 ...

  4. Web前端优化常用规则

    一,尽量减少HTTP请求 二,使用CDN(内容分发网络) 三,添加Expire/Cache-Control头 四,启用Gzip压缩 五,将CSS放在层叠样式表放到head里面 六,将Script放到页 ...

  5. Zabbix学习之路(八)之自动化监控网络发现和主动注册

    1.网络发现  分两步走:创建发现规则(rule)和执行的动作(Action)(1)创建发现规则"Configuration"-->"Create discover ...

  6. (转) 前端面试之js相关问题(一)

    原帖地址:http://stephenzhao.github.io/2016/08/19/Front-end-Job-Interview-Questions/ 最近我也是经历过面试别人和去面试的人了, ...

  7. .net mvc 使用ueditor的开发(官网没有net版本?)

    1.ueditor的下载导入 官网下载地址:https://ueditor.baidu.com/website/download.html · 介绍 有两种,一种开发版,一种Mini版,分别长这样: ...

  8. 理解学习Springboot(一)

    Springboot有何优势呢,网上一大推,这里就不写了. 一.配置maven 1.在maven官网下载maven,http://maven.apache.org/download.cgi 2.将下载 ...

  9. 第三篇 Python关于mysql的API--pymysql模块, mysql事务

    python关于mysql的API--pymysql模块 pymysql是Python中操作MySQL的模块,其使用方法和py2的MySQLdb几乎相同. 模块安装 pip install pymys ...

  10. Jenkins Tomcat安装设置

    Jenkins Tomcat安装设置 以下为必须满足Jenkins Tomcat设置的先决条件. 第1步:验证安装Java 要验证Java安装,打开控制台并执行以下Java命令. OS 任务 命令 W ...