ubuntu 12.04 安装 nginx+php+mysql web服务器
2013-06-08 13:42
826 查看
摘要: Nginx 是一个轻量级,以占用系统资源少,运行效率而成为web服务器的后起之秀,国内现在很多大型网站都以使用nginx,包括腾讯、新浪等大型信息网站,还有淘宝网站使用的是nginx二次开发的web服务器。直接php+mysql这
...
...
Nginx 是一个轻量级,以占用系统资源少,运行效率而成为web服务器的后起之秀,国内现在很多大型网站都以使用nginx,包括腾讯、新浪等大型信息网站,还有淘宝网站使用的是nginx二次开发的web服务器。 直接php+mysql这是Linux web服务器的黄金组合。今天我们一来学如何在ubuntu 12.04 中架设lnmp。 1. 使用官方PPA安装 Nginx 最新版本,使用以下命令: sudo add-apt-repository ppa:nginx/stable sudo apt-get update sudo apt-get install nginx Nginx相关控制命令: 启动 Nginx: sudo /etc/init.d/nginx start 浏览器浏览运行情况输入:http://localhost ;如果现实”Welcome to nginx!”,表明你的 Nginx 服务器安装成功! 关闭 Nginx:sudo /etc/init.d/nginx stop; 重启 nginx:sudo /etc/init.d/nginx restart; 2. 安装 PHP,输入以下命令: sudo apt-get install php5-cli php5-cgi php5-fpm php5-mcrypt php5-mysql 配置Nginx站点,设置: sudo vi /etc/nginx/sites-available/default 修改 “index” 为:“index index.html index.htm index.php;” 删除以下内容: location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; } 测试,创建网站目录 sudo mkdir /var/www/ 建立一个虚拟站点: sudo vi /etc/nginx/sites-available/default 修改root目录: “root /var/www;” 建立一个测试页面: sudo vi /var/www/test.php 在测试页面test.php中加入以下代码: <?php phpinfo();?> 重启nginx sudo /etc/init.d/nginx restart 浏览器输入以下地址,看看有没有安装成功! http://localhost/test.php 3.安装 MySQL 数据库: sudo apt-get install mysql-server 本文采用CC协议发布,转载请注明: 转载自IMCN |
相关文章推荐
- ubuntu 12.04 安装 nginx+php+mysql web服务器
- ubuntu 12.04 安装 nginx+php+mysql web服务器
- ubuntu 12.04 安装 nginx+php+mysql web服务器
- ubuntu 12.04 安装 nginx+php+mysql web服务器
- ubuntu 12.04 安装 nginx+php+mysql web服务器
- [转] ubuntu 12.04 安装 nginx+php+mysql web服务器
- ubuntu 12.04 安装 nginx+php+mysql web服务器
- ubuntu 12.04 安装 nginx+php+mysql web服务器
- ubuntu 12.04 安装 nginx+php+mysql web服务器
- ubuntu 12.04 安装 nginx+php+mysql web服务器
- ubuntu 12.04 安装 nginx+php+mysql web服务器
- Ubuntu 11.04 安装nginx+php5+mysql 的web服务器
- Ubuntu 11.04 安装nginx+php5+mysql 的web服务器
- Ubuntu 11.10 安装nginx+php5+mysql 的web服务器
- 阿里云服务器(Ubuntu 12.04 64位)搭建 Nginx、MySQL、PHP Web服务器 (一)
- rhel5.8的系统上安装nginx+php(FastCGI)+mysql 来构建一个高效的web服务器
- Ubuntu Server 14.04 安装+安全Web服务器(linux+apache+mysql+php)搭建流程(更新)
- Nginx+php(FastCGI)+Memcached+Mysql+APC Nginx高性能web服务器安装 APC模块安装 l
- 阿里云服务器(Ubuntu 12.04 64位)搭建 Nginx、MySQL、PHP Web服务器 (二)
- 手把手教你在centos下编译安装配置高性能web服务器环境nginx+php(fast-cgi)+mysql