LNMP是时下很流行的网站配置,我在配置蝉大师服务器的时候顺带把经验做个分享,蝉大师的网址是:http://www.ddashi.com/

1、第一步, 跟新apt-get

输入:

sudo apt-get update

2、第二步,安装Mysql

输入:

sudo apt-get install mysql-server php5-mysql

安装过程中mysql会要求你给数据库设定密码,输入两次后继续……

输入:

sudo mysql_install_db

继续输入:

sudo /usr/bin/mysql_secure_installation

会提示你输入刚刚设定的mysql密码,输入即可

问你是否要更改密码,输入N即可

接下来Mysql会提示几个问题,填入下边对应的y或n即可

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment. Remove anonymous users? [Y/n] y
... Success! Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y
... Success! By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment. Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success! Reloading the privilege tables will ensure that all changes made so far
will take effect immediately. Reload privilege tables now? [Y/n] y
... Success! Cleaning up...

3、第三步、安装Nginx

依次输入:

echo "deb http://ppa.launchpad.net/nginx/stable/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/nginx-stable.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C300EE8C
sudo apt-get update
sudo apt-get install nginx

启动nginx:

sudo service nginx start

这时候你可以访问你的域名或IP地址来看看Nginx是否工作了

输入如下命令可以知道你的IP:

ifconfig eth0 | grep inet | awk '{ print $2 }'

4、第四步,安装PHP

sudo apt-get install php5-fpm

配置PHP:

sudo nano /etc/php5/fpm/php.ini

找到, cgi.fix_pathinfo=1, 把1改为0即可,如下:

cgi.fix_pathinfo=

接着:

sudo nano /etc/php5/fpm/pool.d/www.conf

找到, listen = 127.0.0.1:9000, 把 127.0.0.1:9000 改成 /var/run/php5-fpm.sock.

listen = /var/run/php5-fpm.sock

保存退出,启动PHP

sudo service php5-fpm restart

配置Nginx

sudo nano /etc/nginx/sites-available/default

启用PHP,绑定目录和index文件

[...]
server {
listen ; root /var/www;
index index.php index.html index.htm; server_name example.com; location / {
try_files $uri $uri/ /index.html;
} error_page /.html; error_page /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
} # pass the PHP scripts to FastCGI server listening on the php-fpm socket
location ~ \.php$ {
try_files $uri =;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params; } }
[...]

可以了,建个文件试试吧:

sudo nano /var/www/info.php

如果觉得有价值,欢迎加我微信(keerol)或关注我微博(weibo/yanghongjin)

在Ubuntu 12.4 下安装 nginx, MySQL, PHP的更多相关文章

  1. Angularjs学习---angularjs环境搭建,ubuntu 12.04下安装nodejs、npm和karma

    1.下载angularjs 进入其官网下载:https://angularjs.org/‎,建议下载最新版的:https://ajax.googleapis.com/ajax/libs/angular ...

  2. Ubuntu 12.04 下安装 Eclipse

    方法一:(缺点是安装时附加openjdk等大量程序并无法去除,优点是安装简单) $ sudo apt-get install eclipse 方法二:(优点是安装内容清爽,缺点是配置麻烦)1.安装JD ...

  3. Ubuntu 12.04下安装QQ 2012 Beta3(转)

    Ubuntu 12.04下安装QQ 2012 Beta3   由于wine的发展非常迅速.现在网上的利用老版本的wine来安装QQ2012的教程已经有些过时了.实际上操作起来非常简单: 第一步:Ctr ...

  4. [转载] Ubuntu 12.04下安装git,SSH及出现的Permission denied解决办法

    如何安装ssh http://os.51cto.com/art/201109/291634.htm 仅需要阅读至成功开启ssh服务即可 http://www.linuxidc.com/Linux/20 ...

  5. Ubuntu 12.04下安装QQ 2012 Beta3

    Ubuntu 12.04下安装QQ 2012 Beta3   由于wine的发展非常迅速.现在网上的利用老版本的wine来安装QQ2012的教程已经有些过时了.实际上操作起来非常简单: 第一步:Ctr ...

  6. Ubuntu 12.04下安装OpenCV 2.4.2

    http://sourceforge.net/projects/opencvlibrary/files/ Ubuntu 12.04下安装OpenCV 2.4.2 http://blog.csdn.ne ...

  7. ubuntu 12.04下安装Qt出现cannot execute binary file的解决方案

    最近在ubuntu 12.04下安装QT的过程中,遇到一个问题. ./qt-opensource-linux-x64-5.7.0.run出现了bash: ./qt-opensource-linux-x ...

  8. Ubuntu 12.04 下安装 VirtualBox 及虚拟机winxp的安装

    参考文档: http://wenku.baidu.com/view/a51ac26c9b6648d7c1c746d7.html 1.首先,先去官网(http://www.virtualbox.org) ...

  9. ubuntu 12.04 编译安装 nginx

    下载源码包 nginx 地址:http://nginx.org/en/download.html 编译前先安装两个包: 直接编译安装会碰到缺少pcre等问题,这时候只要到再安装两个包就ok sudo ...

随机推荐

  1. DW安装步骤

    Adobe Dreamweaver CC 2015破解步骤 Adobe Dreamweaver CC 2015的安装包和破解补丁可以在这里下载.链接: http://pan.baidu.com/s/1 ...

  2. mysql 5.7配置文件参数详解

    read_buffer_size 默认大小:128KB 最大:2GB 最小:8KB 增量:必须为4KB的整数倍,如果配置的不是整数倍,会向下取整 用途: 1.MyISAM表顺序扫描提供的缓存 2.所有 ...

  3. struts2+spring+hibernte整合示例

    简单实现添加用户功能,仅供初学者参考,可自行扩展程序功能(增删改查). 这里贴下代码,需要的可以下载看(因为比较懒). applicationContext.xml <?xml version= ...

  4. 利用flash精确定位asp.net的图像热点区域

    Asp.net的热点区域控件非常有用,但是对于热点区域如何精确定位,设定矩形,圆和多边形要素点的位置,用flash能够精确定位,在flash中制作热点区域的部分,可以是矩形,图形或者文字,然后对于这部 ...

  5. WebView 的使用----android和html的交互

    一.主布局文件 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    xml ...

  6. iOS两种方式加载图片的区别

    加载图片的方式: imageNamed: imageWithContentsOfFile: 加载Assets.xcassets这里面的图片: 1> 打包后变成Assets.car 2> 拿 ...

  7. Spring MVC 3.0 深入及对注解的详细讲解

    核心原理 1.       用户发送请求给服务器.url:user.do 2.       服务器收到请求.发现Dispatchservlet可以处理.于是调用DispatchServlet. 3.  ...

  8. Angular JS的依赖注入

    依赖注入是一个在组件中给出的替代了硬的组件内的编码它们的依赖关系的软件设计模式.这减轻一个组成部分,从定位的依赖,依赖配置.这有助于使组件可重用,维护和测试. AngularJS提供了一个至高无上的依 ...

  9. 作业七:团队项目——Alpha版本冲刺阶段004

    今日进展:我们的扫雷基本界面已经差不多了,准备开始编写内部代码. 今日安排:做好界面,准备开始代码编写.

  10. python的各种编辑器-PyScripter、pycharm 、atom、vscode、Sublime Text等等

    RT,本文主要列举python的各种编辑器-PyScripter.pycharm .atom.vscode.Sublime Text等等. PyScripter 开源 免费 windows only ...