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 ...
随机推荐
- 使用nohup或者tmux将程序挂在后台
程序挂在后台 nohup nohup 命令 & 这样的命令会将屏幕的输出重定向到同目录的nohup.out中,可以使用 > 来重定向输出. nohup 命令 > .log & ...
- Fiddler无所不能——之测试开发攻城狮必备利器
Fiddler无所不能——之测试开发攻城狮必备利器 1.模拟真实网络环境4g网.3g网络.2g网络.弱网.请求超时 开启弱网Rules——Performance——勾选Simulate Modem S ...
- PICT工具一键生成正交试验用例
PICT工具一键生成正交试验用例 作用: 1.解决手动设计大量测试用例.或覆盖不全面问题,提高测试效率 2.读取excel,将生成的参数组合自动带入脚本,进行接口自动化测试 一.PICT简介 PICT ...
- BurpSuite—-Target模块(目标模块)
Target功能 目标工具包含了SiteMap,用你的目标应用程序的详细信息.它可以让你定义哪些对象在范围上为你目前的工作,也可以让你手动测试漏洞的过程,Target分为site map和scope两 ...
- CSS深入理解absolute
1.图片目标来覆盖,无依赖,真不赖: 2.如何定位下拉框,最佳实践来分享: 3.对其居中或边缘,定位实现有脸面: 4.星号时有时没有,破坏队形不用愁: 5.图文对其兼容差,绝对定位来开挂: 6.文字溢 ...
- DSP5509项目之用FFT识别钢琴音调(4)之麦克风输入和Line in输入
1. 麦克风输入需要修改的内容,之前的版本是LINE IN的输入.实现功能,检测麦克风的输入,并且同时在耳机里面播放. #include <csl.h> #include <csl_ ...
- 一起来做Chrome Extension《一些问题》
目录 Unchecked runtime.lastError: The message port closed before a response wa received. 使用 eval Conte ...
- Redash二次开发-开发环境搭建
环境:win7+pycharm 2018.2 +redash 1.安装pycharm并如何正常使用,找度娘. 2.配置pycharm vcs,设置github用户,从github新建redash项目 ...
- Jmeter使用HTTP代理服务器录制脚本
使用Jmeter录制脚本通常使用Badboy工具录制或者Jmeter自带的HTTP代理服务器录制脚本,这里说一下使用HTTP代理服务器录制时遇到的问题. 1. Jmeter安装 下载得到Jmeter ...
- 启动sshd时,报“Could not load host key”错
原文发表于cu:2016-05-24 现象:启动sshd服务时,虽看似服务启动成功,但客户端并不能连接上sshd服务器端.如下: [root@aefe8007a17d ~]# /usr/sbin/ss ...