LNMP详解
目录
LNMP
环境
Mysql:192.168.10.10
Nginx、PHP:192.168.10.11
在服务都部署好之后,对其进行关联;
相关操作命令:
# /usr/local/nginx/sbin/nginx -t
# /usr/local/nginx/sbin/nginx -s reload
Nginx配置
[root@c1 /usr/local/nginx/conf]# cat nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
include extra/kazihuo.conf;
}
PHP解析
[root@c1 /usr/local/nginx/conf/extra]# cat kazihuo.conf
server {
listen 80;
server_name www.kazihuo.com;
location / {
root html/kazihuo;
index index.php index.html index.htm;
}
location ~ .*\.(php|php5)?$ {
root html/kazihuo;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
[root@c1 /usr/local/nginx/html/kazihuo]# cat index.php
<?php phpinfo(); ?>
# 以上代码是显示PHP配置信息
测试:
现在本地电脑做好解析,打开浏览器http://www.kazihuo.com/index.php
Mysql操作
服务安装
详细步骤见博文MYSQL汇总;
连接测试
[root@c1 /usr/local/nginx/html/kazihuo]# cat test_mysql.php
<?php
//$link_id=mysql_connect('主机名','用户','密码');
$link_id=mysql_connect('192.168.10.10','root','000000') or mysql_error();
if ($link_id) {
echo "mysql successful by kazihuo !";
}
else{
echo mysql_error();
}
// 单行注释
/* 多行注释 */
?>
测试结果:

数据配置
# mysql -uroot -p000000
> create database wordpress;
> grant all on wordpress.* to wordpress@'192.168.10.%' identified by '123456';6';
> flush privileges;
> show grants for wordpress@'192.168.10.%';
+---------------------------------------------------------------------+
| Grants for wordpress@192.168.10.% |
+---------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'wordpress'@'192.168.10.%' |
| GRANT ALL PRIVILEGES ON `wordpress`.* TO 'wordpress'@'192.168.10.%' |
+---------------------------------------------------------------------+
> select user,host from mysql.user;
+-----------+--------------+
| user | host |
+-----------+--------------+
| root | % |
| root | 127.0.0.1 |
| wordpress | 192.168.10.% |
| mysql.sys | localhost |
| root | localhost |
+-----------+--------------+
Blogs建立
# wget https://cn.wordpress.org/wordpress-4.9.1-zh_CN.tar.gz
# tar -axvf wordpress-4.9.1-zh_CN.tar.gz
[root@c1 /usr/local/nginx/html/kazihuo]# rm -rf index.php test_mysql.php #此步骤是删除之前的测试文件
# cd wordpress/
# mv * /usr/local/nginx/html/kazihuo/
[root@c1 /usr/local/nginx/html]# chown -R nginx.nginx kazihuo
测试:
浏览器输入:www.kazihuo.com

LNMP详解的更多相关文章
- nginx详解反向代理、负载均衡、LNMP架构上线动态网站(week4_day1_part1)-技术流ken
nginx介绍 Nginx是俄罗斯人编写的十分轻量级的HTTP服务器,Nginx,它的发音为“engine X”,是一个高性能的HTTP和反向代理服务器,同时也是一个IMAP/POP3/SMTP 代理 ...
- nginx详解反向代理,负载均衡,LNMP架构上线动态网站
1.nginx介绍 nginx.org Nginx是俄罗斯人编写的十分轻量级的HTTP服务器,Nginx,它的发音为“engine X”,是一个高性能的HTTP和反向代理服务器,同时也是一个IMAP/ ...
- LNMP笔记:php-fpm – 启动参数及重要配置详解
约定几个目录/usr/local/php/sbin/php-fpm/usr/local/php/etc/php-fpm.conf/usr/local/php/etc/php.ini php-fpm的启 ...
- lnmp 一键安装详解
1.使用putty或类似的SSH工具登陆VPS或服务器: 登陆后运行:screen -S lnmp 如果提示screen: command not found 命令不存在可以执行:yum instal ...
- Nginx 反向代理、负载均衡、页面缓存、URL重写及读写分离详解
转载:http://freeloda.blog.51cto.com/2033581/1288553 大纲 一.前言 二.环境准备 三.安装与配置Nginx 四.Nginx之反向代理 五.Nginx之负 ...
- PHP写在线视频直播技术详解
2016年7月22日 22:26:45 交流QQ:903464207 本文会不断更新 废话一句,如果你要做高性能服务器服务,请去读底层的东西 http tcp/ip socket 了解基础协议,你对如 ...
- Nginx反向代理、负载均衡、页面缓存、URL重写及读写分离详解
大纲 一.前言 二.环境准备 三.安装与配置Nginx 四.Nginx之反向代理 五.Nginx之负载均衡 六.Nginx之页面缓存 七.Nginx之URL重写 八.Nginx之读写分离 注,操作系统 ...
- 详解linux运维工程师入门级必备技能
详解linux运维工程师入门级必备技能 | 浏览:659 | 更新:2013-12-24 23:23 | 标签:linux it自动化运维就是要很方便的运用各种工具进行管理维护,有效的实施服务器保护 ...
- 【转】Nginx+php-fpm+MySQL分离部署详解
转:http://www.linuxidc.com/Linux/2015-07/120580.htm Nginx+php-fpm+MySQL分离部署详解 [日期:2015-07-26] 来源:Linu ...
随机推荐
- freemaker中的map遍历
前两天在freemaker中遇到一个问题,怎么遍历一个Map<List<Object>的map呢? 网上找个很多都是类似下面的: <#if map?exists> < ...
- 算法提高 拿糖果 线性DP
题目链接:拿糖果 思路:首先给小于根号n的素数打表.d(i)表示当前剩余i颗糖,最多可以拿到多少糖. 转移方程:d(i) = max(d(i), k + d(i - 2 * k)),此处k表示 ...
- mysql 导出每张表中的100条数据..............
windows下配好MYSQL 环境变量,cmd 然后: mysqldump -uroot -p123 [数据库名]--where "1=1 limit 100" --lock-a ...
- SQL语句学习
看似简单,但其实包含很多技巧思维 1.查询课程表中所有科目大于80的学生 select distinct name from student where name not in (select nam ...
- TCP协议的三次握手和四次分手
HTTP连接 HTTP协议即超文本传送协议(Hypertext Transfer Protocol ),是Web联网的基础,也是手机联网常用的协议之一,HTTP协议是建立在TCP协议之上的一种应用. ...
- 2_成员函数(Member Functions)
成员函数以定从属于类,不能独立存在,这是它与普通函数的重要区别.所以我们在类定义体外定义成员函数的时候,必须在函数名之前冠以类名,如Date::isLeapYear().但如果在类定义体内定义成员函数 ...
- directdraw显示yuv422(yuy2)
#include <mmsystem.h> void CshowpicDlg::OnBnClickedButton3() { // TODO: 在此添加控件通知处理程序代码 height ...
- HTML多表头表格
1.多表头表格代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://w ...
- freemarker自定义标签报错(五)
freemarker自定义标签 1.错误描述 六月 05, 2014 11:40:49 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严 ...
- freemarker自定义标签报错(八)
1.错误描述 freemarker.core.ParseException: Token manager error: freemarker.core.TokenMgrError: Unknown d ...