Ubuntu14.04搭建LNMP平台

更新源:

apt-get install update

关闭apache2:

/etc/init.d/apache2 stop

安装nginx:

apt-get install nginx

安装MYSQL:

apt-get install mysql-server  #连续输入两次相同密码,密码为mysql管理账户所使用

安装PHP:

apt-get install php5-fpm php5-mysql

配置PHP,修改php.ini文件:

cp /etc/php5/fpm/php.ini /etc/php5/fpm/php.ini.back  #备份php.ini文件

vim /etc/php5/fpm/php.ini

cgi.fix_pathinfo=0 #取消有安全隐患的pathinfo模式

启动php-fpm

service php5-fpm restart

配置nginx,让其使用php5-fpm进程

cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.back

vim /etc/nginx/sites-available/default

server {

listen 80 default_server;

listen [::]:80 default_server ipv6only=on;

root /usr/share/nginx/html;

index index.html index.htm;

server_name localhost;

location / {

# First attempt to serve request as file, then

# as directory, then fall back to displaying a 404.

try_files $uri $uri/ =404;

# Uncomment to enable naxsi on this location

# include /etc/nginx/naxsi.rules

}

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root /usr/share/nginx/html;

}

location ~ \.php$ {

#       try_files $uri =404;

fastcgi_split_path_info ^(.+\.php)(/.+)$;

#       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini

#

#       # 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;

#       fatcgi_param SCRITP_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

}

}

重启nginx服务:

service nginx restart

建立info.php测试文件:

vim /usr/share/nginx/html/info.php

<?php

phpinfo();

?>

浏览器测试:

http://IP/info.php

将制作的php网页页面原文件上传至/usr/share/nginx/html/目录下即可

原文地址:http://blog.51cto.com/idmiaosen/2062546

时间: 2024-12-25 23:21:18

Ubuntu14.04搭建LNMP平台的相关文章

Ubuntu14.04 搭建 node.js 环境(Binaries方式)

从官网下载 http://nodejs.org/download/ Linux Binaries (.tar.gz)  下载下来的是node-v0.10.29-linux-x64.tar.gz文件 解压 $ tar zxvf node-v0.10.29-linux-x64.tar.gz /etc/profile.d/下建立 node.sh文件 export NODEHOME=/home/username/Software/node #指定你的解压后Binaries文件路径 export PATH

ubuntu14.04 安装LNMP

通常我们使用centos来组建LNMP,但是我们开发时多使用ubuntu的桌面版本来调试,下面将详细介绍如何在ubuntu上安装一套LNMP. 一.下载并安装最新的ubuntu14.04桌面版本 二.安装mysql 1. 下载mysql的最新版本,例如: wget http://dl.mysql.cn/mysql5/5.5/mysql-5.5.25.tar.gz 2. 解压缩: tar -xvf mysql-5.5.25.tar.gz 3. 进入mysql文件目录: cd mysql-5.5.2

Ubuntu14.04搭建ELK日志分析系统

系统运维和开发人员可以通过日志了解服务器软硬件信息.检查配置过程中的错误及错误发生的原因.经常分析日志可以了解服务器的负荷,性能安全性,从而及时采取措施纠正错误.日志的作用不言而喻,但对于数量庞大且分布在多台机器上的日志,查看就显得特别麻烦了.所以,对于运维人员来说,使用日志分析系统是非常有必要的. 开源实时日志分析ELK平台能够实现日志的监控与分析,ELK由ElasticSearch.Logstash和Kiabana三个开源工具组成.官方网站:https://www.elastic.co/pr

ubuntu14.04搭建LAMP环境

前言 已经不记得搭建过多少次LAMP的环境了,不仅仅在windows上折腾过,也在linux上弄过,windows倒还好,麻烦事不多,搭建过一次基本上下次就知道应该怎么配置了,可是在linux每次搭建LAMP时我都总是忘记上一次是怎么搭建成功的了... 所以一次又一次地去Google,找教程,而且发现找到的教程都是鱼龙混杂,各有一套章法,让人感觉好像在linux下搭建环境会有n种方法,可是就是不知道到底哪一种才是正确的姿势... 今天搭建,发现现在LAMP在linux已经很容易了,基本上简简单单

Ubuntu14.04搭建JSP与Servlet开发环境及其测试详解

一,搭建JDK开发环境 1,在Java官网下载Jdk软件包,我的系统是64位Ubuntu14.04,所以选择jdk-8u25-linux-x64.tar.gz. 2,解压Jdk软件包 tar xvzf jdk-8u25-linux-x64.tar.gz 3,使用管理员权限拷贝解压的文件夹到/usr/lib/jvm目录下,无需安装 sudo cp -r jdk1.8.0_25 /usr/lib/jvm/ 4,设置环境变量,在/etc/profile的后面添加如下内容,然后输入 source /et

ubuntu14.04搭建gitlab9.0

gitlab是常用的代码管理软件,下面是我在ubuntu14.04上的搭建过程: 首先配置好apt源,最好是官方的源. sudo apt-get install curl openssh-server ca-certificates postfix curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash sudo apt-get install gitlab-

Ubuntu14.04搭建scikit-learn环境及pydev

安装Ubuntu 下载镜像文件: http://www.ubuntu.org.cn/download/ubuntu-kylin 找一个大于2G的U盘制作启动盘,推荐使用大白菜,里面有ISO模式,选择下载下来的镜像文件点击制作启动盘即可. http://www.dabaicai.net.cn/ 插上U盘,从U盘启动电脑,按提示下一步即可. 安装scikit-learn 更改python版本 我安装的是Ubuntu14.04, 内置有python2.7和python3.4,打开terminal, 输

ECS Ubuntu14.04 搭建gitlab 记录

环境: 服务器环境:阿里云ECS Ubuntu14.04系统 确保你的系统和gitlab版本一致. 官方教程: Gitlab 官方地址:https://about.gitlab.com/downloads/ wget https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab_7.7.1-omnibus.5.4.1.ci-1_amd64.deb sudo apt-get install openssh-server sudo a

CentOS6.7源码搭建LNMP平台

LNMP是Linux+ Nginx+ MySQL +PHP的简称.先安装mysql:然后是php,php使用fast-cgi的方式运行:最后安装Nginx. 安装平台:CentOS6.7 X86_64 MySql版本:mysql-5.6.27 MySql安装目录:/usr/local/mysql MySql数据库存放目录:/data/mysql MySql的用户和组:mysql:mysql MySql源码存放目录:/usr/local/src 安装前的准备: (1).关闭selinux vim