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 ...
随机推荐
- Codeforces348C - Subset Sums
Portal Description 给出长度为\(n(n\leq10^5)\)的序列\(\{a_n\}\)以及\(m(m\leq10^5)\)个下标集合\(\{S_m\}(\sum|S_i|\leq ...
- SpringMvc Json LocalDateTime 互转,form urlencoded @ModelAttribute 转换
JDK8 的LocalDate 系列日期API ,比Date 或者 Calendar 都好用很多,但是在SpringMvc 自动装配会有点小问题 会导致抛出类似异常 default message [ ...
- 基础--Redis在Windows环境下的安装
1. 安装Redis 1.1 下载安装包 https://github.com/ServiceStack/redis-windows#3-run-the-redis-serverexe-using-t ...
- NewLife.XCode 上手指南2018版(二)增
目录 NewLife.XCode 上手指南2018版(一)代码生成 NewLife.XCode 上手指南2018版(二)增 NewLife.XCode 上手指南2018版(三)查 NewLife.XC ...
- MySQL之pymysql模块
MySQL之pymysql模块 import pymysql #s链接数据库 conn = pymysql.connect( host = '127.0.0.1', #被连接数据库的ip地址 po ...
- H3C三层交换机配置IP
1.直接在物理端口上设置IP地址. int f1/0/1 port link-mode route #链路模式采用路由 ip add 192.168.10.1 24 ospf network0type ...
- Mapreuduce实现网络数据包的清洗工作
处理后的数据可直接放到hive或者mapreduce程序来统计网络数据流的信息,比如当前实现的是比较简单的http的Get请求的统计 第一个mapreduce:将时间.十六进制包头信息提取出来,并放在 ...
- 我的Java设计模式-原型模式
"不好意思,我是卧底!哇哈哈哈~"额......自从写了上一篇的观察者模式,就一直沉浸在这个角色当中,无法自拨.昨晚在看<使徒行者2>,有一集说到啊炮仗哥印钞票,我去, ...
- C++ string数据类型的实现
#include <cstdlib> #include <cstring> class Mystring { public: Mystring(const char * pda ...
- R︱Softmax Regression建模 (MNIST 手写体识别和文档多分类应用)
本文转载自经管之家论坛, R语言中的Softmax Regression建模 (MNIST 手写体识别和文档多分类应用) R中的softmaxreg包,发自2016-09-09,链接:https:// ...