LNMP官方网站:http://lnmp.org
http://oneinstack.com/install/
安装详细介绍:http://lnmp.org/install.html
1,安装LNMP执行:
wget -c http://soft.vpser.net/lnmp/lnmp1.2-full.tar.gz && tar zxf lnmp1.2-full.tar.gz && cd lnmp1.2-full && ./install.sh lnmp
wget -c http://soft.vpser.net/lnmp/lnmp1.2-full.tar.gz && tar zxf lnmp1.2-full.tar.gz && cd lnmp1.2-full && ./install.sh lnmpa
如需要安装LNMPA或LAMP,将./install.sh 后面的参数替换为lnmpa或lamp即可。
全自动安装过程,无需人工干预,下载完成自动编译安装,以下几项需要选择:
+------------------------------------------------------------------------+
| LNMP V1.2 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: root --这是MYSQL密码
MySQL root password: root
===========================
Do you want to enable or disable the InnoDB Storage Engine?
Default enable,Enter your choice [Y/n]: y
You will enable the InnoDB Storage Engine
===========================
You have 5 options for your DataBase install.
1: Install MySQL 5.1.73
2: Install MySQL 5.5.42 (Default)
3: Install MySQL 5.6.23
4: Install MariaDB 5.5.42
5: Install MariaDB 10.0.17
Enter your choice (1, 2, 3, 4 or 5): 3
You will Install MySQL 5.6.23
===========================
You have 5 options for your PHP install.
1: Install PHP 5.2.17
2: Install PHP 5.3.29
3: Install PHP 5.4.41 (Default)
4: Install PHP 5.5.25
5: Install PHP 5.6.9
Enter your choice (1, 2, 3, 4 or 5): 5
You will install PHP 5.6.9
===========================
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): 1
You will install not install Memory Allocator.
Press any key to install...or Press Ctrl+c to cancel ----到这儿按任意键开始安装 ,整个过程大约一两小时
Install lnmp V1.2 completed! enjoy it.
--最后出现这一句,就是安装成功了。
注意:安装成功后,用SFTP就可直接用ROOT连接。
2,安装站点管理:
http://lnmp.org/faq/lnmp-vhost-add-howto.html
主要命令:
lnmp vhost add --添加站点
lnmp vhost list --列出所有站点
lnmp vhost del --删除站点
LNMP 1.2下需要执行:chattr -i /网站目录/.user.ini 后才能删除网站目录。
3,安全设置:上传网站后建议执行:
chown www:www -R /path/to/dir #对网站目录进行权限设置,/path/to/dir替换为你网站目录。
4,限制部分不需要执行PHP的目录:
vi /usr/local/nginx/conf/vhost/网站名.conf
location ~ /(js|upload)/.*\.(php|php5)?$ {
deny all;
}
location ~ /.*\.(php|php5)?$ {
deny all;
}