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
[sql] view plaincopy- sudo apt-get install mysql-server mysql-client
安装过程中要输入root用户的密码。
我在安装中出错,是原来的mysql-cilent mysql-workbench 未完全卸载,将mysql组件完全卸载的方法:
删除mysql前 先删除一下 /var/lib/mysql 还有 /etc/mysql
[sql] view plaincopy- 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
[sql] view plaincopy- sudo apt-get install nginx
3.安装成功后。我们重启下nginx服务
[sql] view plaincopy- sudo service nginx restart<span style="font-size: 16px; font-family: 'Microsoft Yahei', Arial, Helvetica, sans-serif;"> </span>
启动之后我们就可以访问以下我们的地址了。看能不能出现nginx的欢迎界面。
4.这里我们使用php5-fpm来作为我们的php解析。
[sql] view plaincopy- sudo apt-get install php5-fpm
5.接下来我们要修改一下nginx的站点配置了。
ngnix的配置文件存放在/etc/nginx/sites-availble/default
[sql] view plaincopy- 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相关的一些组件。
[sql] view plaincopy- 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.重启服务
[sql] view plaincopy- sudo service php5-fpm restart
- sudo service nginx restart
ubuntu通过apt-get方式搭建lnmp环境以及php扩展安装相关推荐
- centos6.7、centos6.5下yum方式搭建lnmp环境,php5.4/mysql5.5
由于电脑重装系统,之前虚拟机中的所有系统都打不开了,不得已又得从0开始安装.我下载的是centos6.5的镜像,在虚拟机中安装完以后,执行了一下yum update,系统升成了6.7的,但是对于lnm ...
- 安装虚拟机Ubuntu,搭建lnmp环境碰到的坑(二)
上一篇文章是基础的搭建ubuntu,安装好了之后就该搭建lnmp环境了,在此楼主也是第一次用nginx,如果有什么错误之后,请告知,万分感谢 搭建lnmp的一些基础命令在网上都可以查到,楼主只贴出自己 ...
- Docker - 搭建LNMP环境 - 学习/实践
1.应用场景 主要用于学习使用docker搭建开发环境. 学习容器化技术. 以及快速搭建开发环境, 同时保持团队之间开发/测试环境相同~~~~ 2.学习/操作 1.文档阅读 Docker - 学习/实 ...
- 腾讯云服务器CVM(CentOS 7、Tencent Linux)手动搭建LNMP环境(linux+Nginx+Mariadb+PHP)
手动搭建云服务器运行环境就是喜欢折腾,如果觉得麻烦的网友可以使用LNMP镜像直接启动CVM实例,以便快速建站. 腾讯云服务器CVM(CentOS 7.Tencent Linux)手动搭建LNMP环境( ...
- VirtualBox+vagrant 搭建LNMP环境
VirtualBox+vagrant 搭建LNMP环境 1.安装VirtualBox和vagrant 去各自的官网下载最新的版本就OK了,win7用户需要注意一下,win7下不支持很高版本的vagra ...
- docker搭建 LNMP 环境
一.准备镜像 安装完docker后,更换完镜像源(docker的安装十分简单自行百度即可) 打开/etc/docker目录下的daemon.json 添加以下内容 { "registry-m ...
- centos 6.5 搭建lnmp环境
centos 6.5 搭建lnmp环境 建议安装顺序: mysql------->>编译php---->>编译nginx 最麻烦:编译php出各种错. 最简单:mysql 软件 ...
- WIN10 vagrant和virtualbox虚拟机和一键搭建lnmp环境配置thinkphp虚拟主机
版本:win10系统 virtualbox:5.1.26 vagrant :1.9.7 centos 7.0 xshell/git 首先下载好对应版本的软件 配置vagrant和virtualbox ...
- wordpress支持MySQL5.5_CentOS 5.5安装Nginx、PHP(FastCGI)、MySQL --搭建LNMP环境安装Wordpress...
一.总体介绍 系统环境 CentOS release 5.5 (Final) ,kernel 2.6.18-194.el5 安装 Nginx . PHP(FastCGI) . MySQL ...
最新文章
- 车辆检测--DAVE: A Unified Framework for Fast Vehicle Detection and Annotation
- [生活化技术]组合模式 vs. 理发店价格表
- Win10年度更新开发必备:VS2015 Update 3正式版下载汇总
- const 常量_软件特攻队|const常量,不一样的新玩法
- 深度学习之基于Inception_ResNet_V2和CNN实现交通标志识别
- LeetCode 1144. 递减元素使数组呈锯齿状(奇偶分别遍历)
- java http 异步请求框架_GitHub - huangdali/MyHttpUtils: 一个非常好用的异步网络请求框架...
- 【转载】最全最详细Hadoop学习文章
- css 垂直居中_html中div使用CSS实现水平/垂直居中的多种方式
- 中文站最好的WordPress主题推荐
- mongodb 的命令操作(转)
- Android的FileOutputStream和FileInputStream内部存储文件读取
- Semaphore(多资源多线程)
- 曼彻斯特编码_数据通信之数据编码
- 年轻设计师之于《未来产品的设计》
- Hexo及Next主题配置(最新版)
- HTML 制作简单的下拉菜单
- python里的平方_python中平方和
- 由置换反应引发的思考
- ping: unknown host www.baidu.com 解决办法