Back

LNMP - 安装-指南

Small color 2016年09月22日

一、LNMP的安装
使用putty或类似的SSH工具登陆VPS或服务器;
登陆后运行:screen -S lnmp
如果提示screen: command not found 命令不存在可以执行:yum install screen 或 apt-get install screen安装,详细内容参考screen教程
##先要下载,并根据不同系统进行安装:
wget -c http://www.smallcolor.link/wjian/linux/lnmp1.3.tar.gz
tar zxvf lnmp1.3.tar.gz
cd lnmp1.3
./install.sh #开始进行安装操作

以上为下载及进入安装过程,以下为安装前简易设置,切记输入个其它域名及牢记mysql密码:

+------------------------------------------------------------------------+
| LNMP V1.3 for CentOS Linux Server, Written by Licess |
+------------------------------------------------------------------------+
| A tool to auto-compile & install LNMP/LNMPA/LAMP on Linux |
+------------------------------------------------------------------------+
| For more information please visit http://www.lnmp.org |
+------------------------------------------------------------------------+
Please setup root password of MySQL.(Default password: root)
Please enter: 123456789 #输入mysql的root密码
MySQL root password: 123456789
===========================
Do you want to enable or disable the InnoDB Storage Engine?
Default enable,Enter your choice [Y/n]: n #是否安装InnoDB
You will disable the InnoDB Storage Engine!
===========================
You have 5 options for your DataBase install.
1: Install MySQL 5.1.73
2: Install MySQL 5.5.48 (Default)
3: Install MySQL 5.6.29
4: Install MariaDB 5.5.48
5: Install MariaDB 10.0.23
6: Install MySQL 5.7.11
Enter your choice (1, 2, 3, 4, 5 or 6): 1 #选择mysql版本,我内存小所以选择1
You will install MySQL 5.5.48
===========================
You have 6 options for your PHP install.
1: Install PHP 5.2.17
2: Install PHP 5.3.29
3: Install PHP 5.4.45 (Default)
4: Install PHP 5.5.36
5: Install PHP 5.6.22
6: Install PHP 7.0.7
Enter your choice (1, 2, 3, 4, 5 or 6): 1 #选择php版本,我内存小所以选择1
You will Install PHP 5.2.17
===========================
You have 3 options for your Memory Allocator install.
1: Don't install Memory Allocator. (Default)
2: Install Jemalloc
3: Install TCMalloc
Enter your choice (1, 2 or 3): 2 #2-3是内存优化,1是不用优化。
You will install JeMalloc

#按任意键,设置完成,正式进入安装,预计20-40分钟完成

常见lnmp管理命令:

#1.2版本以后,不需要再执行/root/lnmp了,可以在任意位置执行lnmp命令
lnmp #会出现一些提示信息
lnmp restart #重启
lnmp vhost add #添加网站绑定
lnmp database add #添加数据库信息

二,域名绑定详解
其实所谓的域名绑定,就是通过命令的形式,简易创建一个conf文件到/usr/local/nginx/conf/vhost下面,这个过程完全可以手工创建conf,或者,平时修改目录、域名等,直接修改conf文件,效果完全一样:

lnmp vhost add #执行lnmp添加网站命令
+-------------------------------------------+
| Manager for LNMP, Written by Licess |
+-------------------------------------------+
Please enter domain(example: www.lnmp.org): mcolor.tk #输入绑定的主域名
======================================
Your domain: mcolor.tk
======================================
Do you want to add more domain name? (y/n) y #是否绑定其它域名
Enter domain name(example: lnmp.org *.lnmp.org): www.mcolor.tk #输入其它域名
domain list: www.mcolor.tk
Please enter the directory for the domain: mcolor.tk
(Default directory: /home/wwwroot/vpsmm.com): #默认创建的网站文件所在目录
Virtual Host Directory: /home/wwwroot/mcolor.tk
===========================
Allow Rewrite rule? (y/n)
===========================
y #是否添加伪静态文件
Please enter the rewrite of programme:
wordpress,discuz,typecho,sablog,dabr rewrite was exist.
(Default rewrite: other):typecho #我用的typecho程序
===========================
You choose rewrite=typecho
===========================
===========================
Allow access_log? (y/n)
===========================
n #是否启用日志文件
======================================================
Create database and MySQL user with same name (y/n)
======================================================
y #是否创建mysql数据库
verify your current MySQL root password: **** #输入安装时的mysql数据库root密码
Warning: Using a password on the command line interface can be insecure.
MySQL root password correct.
Enter database name: root #创建数据库用户名
Your will create a database and MySQL user with same name: root
Please enter password for mysql user vpsmm_user: 123456
Your password: 123456 #创建相应密码

Press any key to start create virtul host...

Create Virtul Host directory......
set permissions of Virtual Host directory......
You select the exist rewrite rule:/usr/local/nginx/conf/typecho.conf
Gracefully shutting down php-fpm . done
Starting php-fpm done
Test Nginx configure file......
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

Restart Nginx......
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
User vpsmm_user create Sucessfully.
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
Database: vpsmm_user create Sucessfully.
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
GRANT ALL PRIVILEGES ON vpsmm_user Sucessfully.
Warning: Using a password on the command line interface can be insecure.
FLUSH PRIVILEGES Sucessfully.
================================================
Virtualhost infomation:
Your domain: vpsmm.com
Home Directory: /home/wwwroot/vpsmm.com
Rewrite: typecho
Enable log: no
Database username: vpsmm_user
Database userpassword: vpsmmpasswd
Database Name: vpsmm_user
Create ftp account: no
#以上为新创建网站的一些信息
================================================
2.png

注意:
  • 担心迷路?请收藏备用网址:smallcolor.top  备用网址2:smallcolor.org
  • 免责声明:本站为非营利性站点,本网站提供的资源均系收集于各大外网网站,本网站只提供web页面服务,并不提供影片资源存储和下载,也不参与录制、上传、翻译。
  • Disclaimer: This site for non-profit site, this website provides the resources are collected in each big web site, the site provides web page service only, does not provide video resources storage and download, or recording, upload, translation will not be involved.
  • 本站严格遵守(CC BY-NC-SA 4.0)国际许可协议,所有信息我都注明来源。
  • This website strictly complies with the (CC BY-NC-SA 4.0) international license agreement and indicates the source of all information.
  • 若本站收录的节目无意侵犯了贵司版权,请给下面邮箱地址来信(或者留言),我们会及时处理和回复,谢谢!
  • If the content included in this website is not intended to infringe your copyright, please send a letter to the following email (or message), we will promptly handle and reply, thank you for your support!
  • 富强、民主、文明、和谐,自由、平等、公正、法治,爱国、敬业、诚信、友善。
  • emoji_u1f625.pngemoji_u1f629.pngicon_twisted.pngemoji_u1f62a.pngemoji_u1f61c.pngemoji_u1f64d.pngemoji_u1f618.pngemoji_u1f611.pngicon_cool.pngemoji_u1f61e.pngicon_wink.pngicon_neutral.pngicon_smile.pngemoji_u1f646.pngemoji_u1f620.pngemoji_u1f626.pngemoji_u1f623.pngicon_razz.pngemoji_u1f603.pngemoji_u1f62b.pngicon_eek.pngemoji_u1f605.png
    >Submit

      商业友情链接:

    >