也想出现在这里?联系我们

lnmp安装以及使用教程

2013.11.16 服务器相关
  • 文章介绍
  • 升级版本
  • 评价&建议

从免费虚拟主机到虚拟主机,到winvps,到linuxvps...这算是成长吗?

从winvps开始还可以像操作电脑一样的配置环境。。。自从到了linux后就跟盲人一样,纯属瞎摸了!

之前一小白还教了我个秘籍“装个面板”。。。话说装个面板确实真心方便,可就是有些面板占据太大内存。。。

用阿福话说,开的功能越多,漏洞越多,网站越不安全。。。

直到昨天我的好友阿福才力推我使用lnmp来搭配语言环境。。。好吧。。。不淡定开始了!

连接上ssh后,开始wget命令:

国内的选用:

wget -c http://soft.vpser.net/lnmp/lnmp0.9-full.tar.gz

国外的选用:

wget -c http://soft.vpser.net/lnmp/lnmp0.9.tar.gz

其实用国内vps的还真不多,购买国外低价vps的很多,因此阿福就直接用第二个命令写教程了。(两个安装包的区别就在于下面的是不带软件的,上面的是带全软件的,不用在安装过程中再去下载了的。)

下面就是一行一行复制回车的事情了。

tar zxvf lnmp0.9.tar.gz

cd lnmp0.9

./centos.sh /*如果你的是debian或者是ubuntu的话就用./debian.sh 或./ubuntu.sh*/

输入后会出现如下(加粗部分为你要输入的建议不要使用要建站的域名填写在下方):

=========================================================================
LNMP V0.9 for CentOS/RadHat Linux VPS  Written by Licess
=========================================================================
A tool to auto-compile & install Nginx+MySQL+PHP on Linux

For more information please visit http://www.lnmp.org/
=========================================================================
Please input domain:
(Default domain: www.lnmp.org):myvps.rffan.info  /*这里是输入域名的,不过不要输入你以后要做站的域名*/
===========================
domain=myvps.rffan.info
===========================
===========================
Please input the root password of mysql:
(Default password: root):rffan123456   /*这里是输入mysql 的root密码*/
===========================
mysqlrootpwd=rffan123456
===========================
===========================
Do you want to install the InnoDB Storage Engine?
(Default no,if you want please input: y ,if not please press the enter button): /*这里是选择是否安装InnoDB引擎,应该说大多数都用不着*/
INPUT error,The InnoDB Storage Engine will NOT install!

Press any key to start…

按回车后就可以等待安装完成了。预计时间大概是20-40min

安装完成后的提示信息如下:

========================== Check install ================================
Install lnmp 0.9 completed! enjoy it.
=========================================================================
LNMP V0.9 for CentOS/RadHat Linux VPS  Written by Licess
=========================================================================

For more information please visit http://www.lnmp.org/

lnmp status manage: /root/lnmp {start|stop|reload|restart|kill|status}
default mysql root password:rffan123456
phpinfo : http://myvps.rffan.info/phpinfo.php
phpMyAdmin : http://myvps.rffan.info/phpmyadmin/
Prober : http://myvps.rffan.info/p.php
Add VirtualHost : /root/vhost.sh

The path of some dirs:
mysql dir:   /usr/local/mysql
php dir:     /usr/local/php
nginx dir:   /usr/local/nginx
web dir :     /home/wwwroot

=========================================================================
=========================================================================
Manager for LNMP V0.9  ,  Written by Licess
=========================================================================
LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux
This script is a tool to Manage status of lnmp
For more information please visit http://www.lnmp.org

Usage: /root/lnmp {start|stop|reload|restart|kill|status}
=========================================================================
Nginx is runing!
php-fpm is runing!
SUCCESS! MySQL running (13615)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN
tcp        0      0 :::22                       :::*                        LISTEN

下面是使用教程。。。

首先确保你是在root目录下的

cd /root

然后开始我们的建站之路了使用如下命令

sh vhost.sh

来开始建站。输入命令后会有如下提示,注意,不要打错任何一个字,打错了,那么你只能ctrl+c取消,重新来过了。嗯,咱们下面开始的是绑定域名环节

[root@MyVPS ~]# sh vhost.sh
=========================================================================
Add Virtual Host for LNMP V0.9 , Written by Licess
=========================================================================
LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux
This script is a tool to add virtual host for nginx
For more information please visit http://www.lnmp.org/

=========================================================================
Please input domain:
(Default domain: www.lnmp.org): www.rffan.info   /*这里输入你的域名,前面有提示的*/

===========================
domain=www.rffan.info
===========================
Do you want to add more domain name? (y/n) /*这个是问你要不要再添加域名*/
y                                                     /*阿福选择了Y,因为阿福还有个不带www的要绑定*/
Type domainname,example(bbs.vpser.net forums.vpser.net luntan.vpser.net):
rffan.info      /*在这里输入不带www的域名了*/
===========================
domain list=rffan.info
===========================
Please input the directory for the domain:www.rffan.info :  /*在这里填写你的程序文件的路径,随便你填*/
(Default directory: /home/wwwroot/www.rffan.info):/home/www/rffan.info
===========================
Virtual Host Directory=/home/www/rffan.info
===========================
===========================
Allow Rewrite rule? (y/n)  /*这里问你要不要添加伪静态,当然要了,选Y*/
===========================
y
Please input the rewrite of programme :
wordpress,discuz,typecho,sablog,dabr rewrite was exist.
(Default rewrite: other):wordpress /*这里问你选什么规则的伪静态,好吧阿福用的是wordpress*/
===========================
You choose rewrite=wordpress
===========================
===========================
Allow access_log? (y/n)                            /*日志文件,SEO分析蜘蛛,还有被公鸡的时候也有用,建议定期清理*/
===========================
y
Type access_log name(Default access log file:www.rffan.info.log):

===========================
You access log file=www.rffan.info.log
===========================

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/wordpress.conf
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……
=========================================================================
Add Virtual Host for LNMP V0.9 , Written by Licess
=========================================================================
For more information please visit http://www.lnmp.org/

Your domain:www.rffan.info
Directory of www.rffan.info:/home/www/rffan.info

=========================================================================

好了,按照上面的操作之后,域名就绑定完成了。下面让我们来上传文件和创建数据库吧。

上传文件的话,如果网络上有现成的文档,那么直接wget就OK了,命令如下

wget -c http://cn.wordpress.org/wordpress-3.5.1-zh_CN.tar.gz   /*这个网址就是wordpress最新中文版的地址*/

tar zxvf wordpress-3.5.1-zh_CN.tar.gz如果你的是zip的压缩包的话,使用命令unzip wordpress-3.5.1-zh_CN.zip解压

cp -a wordpress/* /home/www/rffan.info   /*这里的home/www/rffan.info可以替换成你的网址*/

chown -R www:www /home/www/rffan.info /*这句话的意思就是给nginx足够权限*/一定要被文件夹足够权限!

OK酱紫就OK了,不过如果你不想用命令,那么你可以回过头看看winscp的使用,相信WINSCP更符合第一次玩linuxvps的孩纸的口味。

为了安全建议屏蔽php报错,即php.in里 display_errors = off

下面就让我们来创建数据库吧

在浏览器里面输入:

http://IP/phpmyadmin/

当然你可以在登陆页面上面选择语言,如果你的英语不错的话,那么- -还是继续用英语吧,阿福不介意~

然后输入用户名 :root 密码:ffan123456 

酱紫就进入了phpmyadmin了,点击上面的数据库,

然后再中间输入要创建的数据中的名字就OK了。

至此,所有创建网站所需要的准备都OK了。

那么在浏览器里面输入你的网址(前提是你已经在DNS那边解析了你的域名到你的VPS上)然后按照提示安装即可~祝你好运~

有用17
  • 2013.11.16初次和大家见面了!

等待您对该主题的建议

发表评论

还能输入240个字

Hi, 欢迎加入Wordpress技术交流群,带你装逼带你飞!

我要入群
也想出现在这里?联系我们
wordpress加速

我来推荐一个更牛逼的给你看看?

  • 猛戳我吧