lnmp架构——mysql.nginx.php的搭建

mysql
首先在官网上下载安装包
解压安装包进入其目录
这里写图片描述
然后下载cmake编译器
这里写图片描述
进行编译配置
出现依赖性的问题 就手动安装解决
然后make make install
这里要注意的时在重新编译需要删除旧的对文件的缓存信息
完成之后会在/usr/local/lnmp/mysql生成目录

编辑my-default.cnf
这里写图片描述
复制并覆盖源/etc/my.cnf
这里写图片描述

这里写图片描述
将mysql的启动脚本放置在/etc/init.d/mysqld

这里写图片描述
建立mysql用户以及用户组
这里写图片描述
修改环境变量 并刷新
这里写图片描述
初始化mysqld

php
下载php的源码包

这里写图片描述
这里写图片描述
解决完依赖性报错后 make&&make install
这里写图片描述
进入php的etc目录
这里写图片描述
在源码 包内部 将php-ini-production 复制到php的etc下 并更名为php.ini
这里写图片描述
根该配置文件
这里写图片描述
建立nginx用户 因为在下载时制定为nginx用户以及nginx组
这里写图片描述
在面下载nginx的源码包并安装 可以参考前几篇博客的nginx的负载均衡的搭建
要是不想进行启动脚本的更改需要在环境里作声明
这里写图片描述
打开配置文件 并更改php的服务栏
这里写图片描述
在nginx的发布目录里面编写网页
这里写图片描述
安装论坛
使其与数据库结合
这里写图片描述
解压到nginx的html下
并给予其相应的权限
php与memcache模块
这里写图片描述

##########php添加模块##########
#tar zxf memcache-2.2.5.tgz                 ##先下载模块  然后解压
#cd memcache-2.2.5            
#cd /usr/local/lnmp/php/bin
#vim ~/.bash_profile                 ##添加一个变量路径
内容:
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/usr/local/lnmp/mysql/bin:/usr/local/lnmp/php/bin

export PATH
结束,保存退出
#which phpize                    
#source ~/.bash_profile                    ##加载路径
#which phpize
#cd memcache-2.2.5
#phpize                        ##预编译
#./configure                     ##
#make                            ##编译
#make install                    ##安装
#cd /usr/local/lnmp/php/lib/php/extensions/no-debug-non-zts-20131226/
#ls
#php -m                         ##查看php的模块
#php -m | grep memcache
#/etc/init.d/php-fpm status            ##打开php-fpm
#/etc/init.d/php-fpm start

#cd /usr/local/lnmp/php/etc
#vim php.ini                     ##添加模块
     850 extension=memcache.so

#/etc/init.d/php-fpm reload
#php -m | grep memcache            ##查看添加模块,如果出现memcache,说明模块添加成功
#cd memcache-2.2.5
#cp example.php memcache.php /usr/local/lnmp/nginx/html/
#netstat -antple | grep 11211
#yum install memcached -y         ##因为memcacahe要连接11211端口 所以安装memcached 它监听的就是11211端口
#vim example.php

#cd /usr/local/lnmp/nginx/html/
#vim memcache.php
  22 define('ADMIN_USERNAME','memcache');    // Admin Username
  23 define('ADMIN_PASSWORD','wrc');   // Admin Password
  24 define('DATE_FORMAT','Y/m/d H:i:s');
  25 define('GRAPH_SIZE',200);
  26 define('MAX_ITEM_DUMP',50);
  27
  28 $MEMCACHE_SERVERS[] = 'localhost:11211'; // add more as an array
:wq
#vim /etc/sysconfig/memcached
#/etc/init.d/memcached start

猜你喜欢

转载自blog.csdn.net/Ff12123/article/details/81428193
今日推荐