ubuntu通过apt-get方式搭建lnmp环境以及php扩展安装
v
一直是在用的lnmp的集成安装包搭建lnmp环境,因为工作需要需要安装ldap扩展,在网上怎么都找不到源码安装包,只能卸载掉原来的lnmp环境,用ubuntu的php5-ldap扩展,
在安装中遇到一些问题,网上的文章坑爹的比较多,写篇文章记录下来。
1.安装MySQL
- sudo apt-get install mysql-server mysql-client
安装过程中要输入root用户的密码。
我在安装中出错,是原来的mysql-cilent mysql-workbench 未完全卸载,将mysql组件完全卸载的方法:
删除mysql前 先删除一下 /var/lib/mysql 还有 /etc/mysql
- sudo rm /var/lib/mysql/ -R
- sudo rm /etc/mysql/ -R
- sudo apt-get autoremove mysql* --purge
- sudo apt-get remove apparmor
全部删除之后再执行 apt-get install mysql-server mysql -client
2.安装nginx
- sudo apt-get install nginx
3.安装成功后。我们重启下nginx服务
- sudo service nginx restart<span style="font-size: 16px; font-family: 'Microsoft Yahei', Arial, Helvetica, sans-serif;"> </span>
启动之后我们就可以访问以下我们的地址了。看能不能出现nginx的欢迎界面。
4.这里我们使用php5-fpm来作为我们的php解析。
- sudo apt-get install php5-fpm
5.接下来我们要修改一下nginx的站点配置了。
ngnix的配置文件存放在/etc/nginx/sites-availble/default
- server {
- listen 80; ## listen for ipv4; this line is default and implied
- listen [::]:80 default ipv6only=on; ## listen for ipv6
- root /usr/share/nginx/www;
- index index.php index.html index.htm;
- # Make site accessible from http://localhost/
- server_name _;
- location / {
- # First attempt to serve request as file, then
- # as directory, then fall back to index.html
- try_files $uri $uri/ /index.html;
- }
- location /doc {
- root /usr/share;
- autoindex on;
- allow 127.0.0.1;
- deny all;
- }
- #error_page 404 /404.html;
- # redirect server error pages to the static page /50x.html
- #
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root /usr/share/nginx/www;
- }
- # proxy the PHP scripts to Apache listening on 127.0.0.1:80
- #
- #location ~ \.php$ {
- # proxy_pass http://127.0.0.1;
- #}
- # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
- #
- location ~ \.php$ {
- try_files $uri =404;
- # With php5-cgi alone:
- # fastcgi_pass 127.0.0.1:9000;
- # With php5-fpm:
- # fastcgi_pass unix:/var/run/php5-fpm.sock;
- fastcgi_index index.php;
- include fastcgi_params;
- }
- # deny access to .htaccess files, if Apache's document root
- # concurs with nginx's one
- #
- location ~ /\.ht {
- deny all;
- }
- }
6.我们在安装php5相关的一些组件。
- sudo apt-cache search php5
- 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.重启服务
- sudo service php5-fpm restart
- sudo service nginx restart
一直是在用的lnmp的集成安装包搭建lnmp环境,因为工作需要需要安装ldap扩展,在网上怎么都找不到源码安装包,只能卸载掉原来的lnmp环境,用ubuntu的php5-ldap扩展,
在安装中遇到一些问题,网上的文章坑爹的比较多,写篇文章记录下来。
1.安装MySQL
- sudo apt-get install mysql-server mysql-client
安装过程中要输入root用户的密码。
我在安装中出错,是原来的mysql-cilent mysql-workbench 未完全卸载,将mysql组件完全卸载的方法:
删除mysql前 先删除一下 /var/lib/mysql 还有 /etc/mysql
- sudo rm /var/lib/mysql/ -R
- sudo rm /etc/mysql/ -R
- sudo apt-get autoremove mysql* --purge
- sudo apt-get remove apparmor
全部删除之后再执行 apt-get install mysql-server mysql -client
2.安装nginx
- sudo apt-get install nginx
3.安装成功后。我们重启下nginx服务
- sudo service nginx restart<span style="font-size: 16px; font-family: 'Microsoft Yahei', Arial, Helvetica, sans-serif;"> </span>
启动之后我们就可以访问以下我们的地址了。看能不能出现nginx的欢迎界面。
4.这里我们使用php5-fpm来作为我们的php解析。
- sudo apt-get install php5-fpm
5.接下来我们要修改一下nginx的站点配置了。
ngnix的配置文件存放在/etc/nginx/sites-availble/default
- server {
- listen 80; ## listen for ipv4; this line is default and implied
- listen [::]:80 default ipv6only=on; ## listen for ipv6
- root /usr/share/nginx/www;
- index index.php index.html index.htm;
- # Make site accessible from http://localhost/
- server_name _;
- location / {
- # First attempt to serve request as file, then
- # as directory, then fall back to index.html
- try_files $uri $uri/ /index.html;
- }
- location /doc {
- root /usr/share;
- autoindex on;
- allow 127.0.0.1;
- deny all;
- }
- #error_page 404 /404.html;
- # redirect server error pages to the static page /50x.html
- #
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root /usr/share/nginx/www;
- }
- # proxy the PHP scripts to Apache listening on 127.0.0.1:80
- #
- #location ~ \.php$ {
- # proxy_pass http://127.0.0.1;
- #}
- # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
- #
- location ~ \.php$ {
- try_files $uri =404;
- # With php5-cgi alone:
- # fastcgi_pass 127.0.0.1:9000;
- # With php5-fpm:
- # fastcgi_pass unix:/var/run/php5-fpm.sock;
- fastcgi_index index.php;
- include fastcgi_params;
- }
- # deny access to .htaccess files, if Apache's document root
- # concurs with nginx's one
- #
- location ~ /\.ht {
- deny all;
- }
- }
6.我们在安装php5相关的一些组件。
- sudo apt-cache search php5
- 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.重启服务
- sudo service php5-fpm restart
- sudo service nginx restart
ubuntu通过apt-get方式搭建lnmp环境以及php扩展安装的更多相关文章
- Centos7.2 下搭建LNMP环境(终极版)Yum安装
PHP7.1+Nginx+MySQL5.7 安装PHP //安装源只要遇到选择的全是Y rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-rele ...
- Centos 7 下yum搭建lnmp环境(yum安装方式)
我们都知道linux下安装软件主要有三种方式: 1.源码编译安装,即下载软件源代码,利用gcc g++ make 等编译工具进行编译安装: 此方式的优点:可以指定软件版本,可选择性好:编译时可以手动指 ...
- docker搭建lnmp环境(问题,资料,命令)
入门参考 http://www.runoob.com/docker/docker-install-nginx.html 十大常用命令玩转docker 1. #从官网拉取镜像 docker pull & ...
- CentOS6.6搭建LNMP环境
CentOS6.6搭建LNMP环境 1.设置yum源,本地安装依赖包 1 yum -y install gcc gcc-c++ automake autoconf libtool make 2.下载依 ...
- Yum搭建LNMP环境(动、静、库分离)(week4_day5)--技术流ken
前言 本篇博客使用yum来搭建lnmp环境,将采用动态,静态以及数据库分开安装的方式即nginx,php,mysql.会被分开安装在不同的服务器之上,搭建出来一套lnmp环境,并部署wordpress ...
- [Linux] deepin15.8搭建LNMP环境
LAMP和LNMP LAMP==Linux+Apache+Mysql+PHP LNMP==Linux+Nginx+Mysql+PHP 安装nginx sudo apt install nginx 安装 ...
- Mac下docker搭建lnmp环境 + redis + elasticsearch
之前在windows下一直使用vagrant做开发, 团队里面也是各种开发环境,几个人也没有统一环境,各种上线都是人肉,偶尔还会有因为开发.测试.生产环境由于软件版本或者配置不一致产生的问题, 今年准 ...
- centos7 yum搭建lnmp环境及配置wordpress超详细教程
yum安装lnmp环境是最方便,最快捷的一种方法.源码编译安装需要花费大量的人类时间,当然源码编译可以个性化配置一些其它功能.目前来说,yum安装基本满足我们搭建web服务器的需求. 本文是我根据近期 ...
- 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 ...
随机推荐
- 后台运行spark-submit命令的方法
在使用spark-submit运行工程jar包时常常会出现一下两个问题: 1.在程序中手打的log(如System.out.println(“***testRdd.count=”+testRdd.co ...
- Ajax的跨域请求——JSONP的使用
一.什么叫跨域 域当然是别的服务器 (说白点就是去别服务器上取东西) 只要协议.域名.端口有任何一个不同,都被当作是不同的域. 总而言之,同源策略规定,浏览器的ajax只能访问跟它的HTML页面同源( ...
- 20155301 《Java程序设计》实验五网络编程与安全
20155301 <Java程序设计>实验五网络编程与安全 实验内容 实验1: 两人一组结对编程:参考http://www.cnblogs.com/rocedu/p/6766748.htm ...
- 2017-2018-1 20155307 《信息安全系统设计基础》第san周学习总结
2017-2018-1 20155307 <信息安全系统设计基础>第三周学习总结 教材学习内容总结 无符号数和有符号数的特性,数字如何表示,IEEE标准,浮点数格式.(我感觉我把课下测试做 ...
- 20155330 实验三 敏捷开发与XP实践
20155330 实验三 敏捷开发与XP实践 实验内容 XP基础 XP核心实践 相关工具 实验步骤 (一)敏捷开发与XP 软件工程是把系统的.有序的.可量化的方法应用到软件的开发.运营和维护上的过程. ...
- Potree学习总结
一. 简介 基于Web端的三维模型展示,这里仅介绍Three.js和Potree. Three.js 是一款基于WebGL的运行在浏览器中的 3D 开源引擎,用它创建各种三维场景.它类似于M ...
- 成都Uber优步司机奖励政策(4月13日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...
- 【BZOJ3110】【LG3332】[ZJOI2013]K大数查询
[BZOJ3110][LG3332][ZJOI2013]K大数查询 题面 洛谷 BZOJ 题解 和普通的整体分治差不多 用线段树维护一下每个查询区间内大于每次二分的值\(mid\)的值即可 然后再按套 ...
- hadoop 、hive 的一些使用经验。
1.queue的设置 hadoop2.0支持了queue,在hadoop程序里面进行queue的配置: job.getConfiguration().set("mapred.job.queu ...
- php-laravel安装与使用
1.框架作用 提供了一些主体功能,方便开发者快速开发 2.PHP框架 laravel ThinkPHP 3.首先要安装composer软件 1.作用 主要管理PH ...