LNMP环境部署及搭建qqfarm

 

一、LNMP介绍

 
LNMP是指一组软件名称首字母缩写。
L指Linux;N指Nginx;M一般指MySQL,也可以指MariaDB;P一般指PHP,也可以指Perl或Python。
LNMP代表的就是:Linux+Nginx+MySQL+PHP这种网站服务器架构。
Linux是一个基于UNIX的操作系统,是目前最流行的免费操作系统。代表版本有:Debian、CentOS、Ubuntu等。
Nginx是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP代理服务器。
Mysql是一个小型关系型数据库管理系统。
MariaDB 数据库管理系统是 MySQL 数据库的一个分支,完全兼容 MySQL 数据库,主要由开源社区维护。
PHP是一种在服务器端执行的嵌入HTML文档的脚本语言。
这四种软件均为免费开源软件,组合到一起,成为一个免费、高效、扩展性强的网站服务系统。
 

二、项目环境

  1. 腾讯云服务器(使用VMware虚拟机也可以)
  2. CentOS操作系统
  3. Finalshell远程连接工具
  4. 相关程序
     

三、清理环境

[root@VM-0-5-centos ~]# setenforce 0				 #临时关闭selinux
[root@VM-0-5-centos ~]# systemctl stop firewalld  	 #关闭防火墙
[root@VM-0-5-centos ~]# systemctl disable firewalld	 #开机禁用防火墙
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

 

四、LNMP环境部署

  1. 安装Nginx
[root@VM-0-5-centos ~]# yum install -y epel-release wget vim bash-completion lrzsz unzip	#安装工具
[root@VM-0-5-centos ~]# yum -y install nginx	#安装nginx

  1. 安装PHP
[root@VM-0-5-centos ~]# yum -y install php php-fpm php-curl php-intl php-mcrypt php-mysql php-mbstring php-xml php-dom php-gd gd

  1. 安装mysql
[root@VM-0-5-centos ~]# yum install -y mariadb mariadb-server

 

五、启动服务及设置开机启动

[root@VM-0-5-centos ~]# systemctl start nginx
[root@VM-0-5-centos ~]# systemctl start mariadb
[root@VM-0-5-centos ~]# systemctl start php-fpm
[root@VM-0-5-centos ~]# systemctl enable nginx
[root@VM-0-5-centos ~]# systemctl enable mariadb
[root@VM-0-5-centos ~]# systemctl enable php-fpm

 

六、服务配置

  1. 数据库配置
[root@VM-0-5-centos ~]# mysql -u root -e 'create database farm;'

  1. Nginx配置
[root@VM-0-5-centos ~]# mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
[root@VM-0-5-centos ~]# mv /etc/nginx/nginx.conf.default /etc/nginx/nginx.conf
[root@VM-0-5-centos ~]# vim /etc/nginx/nginx.conf # 修改配置文件中的一下配置
 ...
 43       location / {
 44           root   html;					==>改为 root   /webroot/farm;
 45           index  index.html index.htm;  ==>改为 index  index.php index.html index.htm;
 46         }
 ... 
 ... ...
 65         #location ~ \.php$ {
 66         #    root           html;
 67         #    fastcgi_pass   127.0.0.1:9000;
 68         #    fastcgi_index  index.php;
 69         #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
 70         #    include        fastcgi_params;
 71         #}
==>改为
 65         location ~ \.php$ {
 66             root           /webroot/farm;
 67             fastcgi_pass   127.0.0.1:9000;
 68             fastcgi_index  index.php;
 69             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
 70           include        fastcgi_params;
 71         }

  1. php配置
[root@VM-0-5-centos ~]# vim /etc/php.ini
将short_open_tag = Off 改为 On

 

七、重启服务

[root@VM-0-5-centos ~]# systemctl restart nginx
[root@VM-0-5-centos ~]# systemctl restart php-fpm

 

八、上线产品(qqfarm)

[root@VM-0-5-centos ~]# mkdir -p /webroot/farm
[root@VM-0-5-centos ~]# rz    # 上传包
[root@VM-0-5-centos ~]# unzip farm-ucenter1.5.zip  # 解压包
[root@VM-0-5-centos ~]# cp -rf upload/* /webroot/farm
[root@VM-0-5-centos ~]# chown -R nginx.nginx /webroot/farm
[root@VM-0-5-centos ~]# mysql -u root farm <./upload/qqfarm.sql

 

九、安装向导

  1. 复制自己服务器的ip地址
    finalshell
  2. 在浏览器地址栏输入ip地址打开网页
    安装环境检测
    到这里我们发现需要更改文件目录权限才能继续安装,并且需要更改的文件全在 /webroot/farm/ 下,那么直接将路径下的所有文件修改权限
[root@VM-0-5-centos ~]# ls /webroot/farm/
bbs  home  index.php  install  logo.jpg  qqfarm.sql  ucenter
[root@VM-0-5-centos ~]# chmod -R 777 /webroot/farm/   			#对目录递归修改

  1. 权限修改完成后,刷新网页,然后下一步
    文件权限合格
  2. 填写相关信息
    信息填写
  3. 使用默认导航页为首页

安装完成

  1. 安装信息,防止忘记可以保存一下

安装信息

  1. 入口界面,点击"网络家园"进入

入口界面

  1. 进入主页,点击左下角"QQ农场"
    个人主页
  2. qqfarm部署完成,可体验游戏,后台用户管理,修改用户参数
    农场界面
  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值