ubuntu15.10配置LNMP(linux+nginx+mysql+php)
来源:互联网 发布:陕西用友软件 编辑:程序博客网 时间:2024/05/22 07:58
1.安装MYSQL
提示用户名密码
root
root
2.安装nginx
启动
查看
http://127.0.0.1跳出Welcome to nginx!说明配置成功
3.安装PHP5
4.配置nginx.conf
配置/etc/nginx/nginx.conf
搜索文字worker_processes找到worker_processes auto;改为worker_processes 4;
搜索文字keepalive_timeout找到keepalive_timeout 65;改为keepalive_timeout 2;
5.配置Nginx让其使用php-fpm进程
更改如下,直接复制替换
重新加载nginx
5.配置PHP,修改php.ini文件
设置,取消分号;将1改为0
重新加载 PHP-FPM:
6.测试运行
创建探针文件info.php到/usr/share/nginx/html目录下
浏览器访问探针文件http://127.0.0.1/info.php
如果出现PHP版本信息说明配置成功
7.测试mysql
创建测试文件sqltest.php到/usr/share/nginx/html目录下
访问http://127.0.0.1/sqltest.php
如果出现OK字符说明mysql配置成功
apt-get install mysql-server
提示用户名密码
root
root
2.安装nginx
apt-get install nginx
启动
service nginx start
查看
http://127.0.0.1跳出Welcome to nginx!说明配置成功
3.安装PHP5
apt-get install php5-fpm php5-mysql
4.配置nginx.conf
配置/etc/nginx/nginx.conf
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bakgedit /etc/nginx/nginx.conf
搜索文字worker_processes找到worker_processes auto;改为worker_processes 4;
搜索文字keepalive_timeout找到keepalive_timeout 65;改为keepalive_timeout 2;
5.配置Nginx让其使用php-fpm进程
cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bakgedit /etc/nginx/sites-available/default
更改如下,直接复制替换
server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.php index.html index.htm; server_name server_domain_name_or_IP; location / { try_files $uri $uri/ =404; } error_page 404 /404.html; 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)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }}
重新加载nginx
service nginx reload
5.配置PHP,修改php.ini文件
gedit /etc/php5/fpm/php.ini
设置,取消分号;将1改为0
cgi.fix_pathinfo=0:
重新加载 PHP-FPM:
service php5-fpm reload
6.测试运行
创建探针文件info.php到/usr/share/nginx/html目录下
gedit /usr/share/nginx/html/info.php
<?phpphpinfo();?>
浏览器访问探针文件http://127.0.0.1/info.php
如果出现PHP版本信息说明配置成功
7.测试mysql
创建测试文件sqltest.php到/usr/share/nginx/html目录下
gedit /usr/share/nginx/html/sqltest.php
<?php$link=mysql_connect("localhost","root","root");if(!$link) echo "FAILD!";else echo "OK!";?>
访问http://127.0.0.1/sqltest.php
如果出现OK字符说明mysql配置成功
0 0
- ubuntu15.10配置LNMP(linux+nginx+mysql+php)
- LNMP(Linux+Nginx+Mysql+PHP)
- LNMP安装配置-linux Nginx/Mysql/Php/Phpmyadmin(CentOS vps)
- 搭建LNMP(linux+nginx+mysql+php)服务器环境配置实例教程
- LNMP(linux+nginx+mysql+php)服务器环境配置
- LNMP(linux+nginx+mysql+php)服务器环境配置
- LNMP(linux+nginx+mysql+php)服务器环境配置
- LNMP服务器环境配置 (linux+nginx+mysql+php)
- LNMP(linux+nginx+mysql+php)服务器环境配置
- LNMP(linux+nginx+mysql+php)服务器环境配置
- LNMP(linux+nginx+mysql+php)服务器环境配置
- centos6.6配置LNMP(linux+nginx+mysql+php)
- LNMP(linux+nginx+mysql+php)服务器环境配置
- LNMP(linux+nginx+mysql+php)服务器环境配置
- LNMP(linux+nginx+mysql+php)服务器环境配置
- LNMP(linux+nginx+mysql+php)服务器环境配置
- LNMP(linux+nginx+mysql+php)服务器环境配置
- LNMP(linux+nginx+mysql+php)服务器环境配置
- 图像处理的三个基本操作——灰度化、锐化、平滑
- 修改Oracle用户密码
- nginx+php-fpm总是504 time out
- Spark1.51 本地启动了Master和一个Slave后,在Spark-Shell里跑,看出sc.textFile找数据的stacktrace
- duplicate symbols for architecture i386
- ubuntu15.10配置LNMP(linux+nginx+mysql+php)
- 英语学习素材
- 传统软件行业和互联网行业有什么区别?
- 2015-11-05
- HDU 5525 Product(数论)
- 对Class.getResourceAsStream和ClassLoader.getResourceAsStream方法所使用的资源路径的解
- Win64,VS2010配置PCL1.6.0(64)
- 达内学习日志Day44:ListAccountServlet(封装<一>)
- Linux 下打包压缩 war 和解压 war 包