<pre >##先要下载,并根据不同系统进行安装:
wget -c http://soft.vpser.net/lnmp/lnmp1.5.tar.gz
tar zxvf lnmp1.5.tar.gz
cd lnmp1.5
./install.sh #开始进行安装 *** 作
<p >以上为下载及进入安装过程,以下为安装前简易设置,切记输入个其它域名及牢记MysqL密码:
<pre >+------------------------------------------------------------------------+
| LNMP V1.5 for CentOS linux Server,Written by licess |
+------------------------------------------------------------------------+
| A tool to auto-compile & install LNMP/LNMPA/LAMP on linux |
+------------------------------------------------------------------------+
| For more information please visit https://lnmp.org |
+------------------------------------------------------------------------+
You have 10 options for your DataBase install.
1: Install MysqL 5.1.73
2: Install MysqL 5.5.60 (Default)
3: Install MysqL 5.6.40
4: Install MysqL 5.7.22
5: Install MysqL 8.0.11
6: Install MariaDB 5.5.60
7: Install MariaDB 10.0.35
8: Install MariaDB 10.1.33
9: Install MariaDB 10.2.14
0: DO NOT Install MysqL/MariaDB
Enter your choice (1,2,3,4,5,6,7,8,9 or 0): #选择MysqL版本 默认为5.5.60
No input,You will install MysqL 5.5.60Please setup root password of MysqL.
Please enter: vpsmm.com #输入MysqL的密码Do you want to enable or disable the InnoDB Storage Engine?
Default enable,Enter your choice [Y/n]: n #是否安装InnoDB环境 默认不需要 whmcs之类特殊程序需求
You will disable the InnoDB Storage Engine!You have 8 options for your PHP install.
1: Install PHP 5.2.17
2: Install PHP 5.3.29
3: Install PHP 5.4.45
4: Install PHP 5.5.38
5: Install PHP 5.6.36 (Default)
6: Install PHP 7.0.30
7: Install PHP 7.1.18
8: Install PHP 7.2.6
Enter your choice (1,7 or 8): 8 #默认PHP版本 这里选择最新
You will install PHP 7.2.6
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.
<pre >#1.2版本以后,不需要再执行/root/lnmp了,可以在任意位置执行lnmp命令
lnmp #会出现一些提示信息
lnmp restart #重启
lnmp vhost add #添加网站绑定
lnmp database add #添加数据库信息
<p ID="lnmp-2"><a href="#lnmp-2">二,域名绑定详解
<p >其实所谓的域名绑定,就是通过命令的形式,简易创建一个conf文件到/usr/local/nginx/conf/vhost下面,这个过程完全可以手工创建conf,或者,平时修改目录、域名等,直接修改conf文件,效果完全一样:
<pre >lnmp vhost add #执行lnmp添加网站命令
+-------------------------------------------+
| Manager for LNMP,Written by Licess |
+-------------------------------------------+
Please enter domain(example: www.lnmp.org): vpsmm.com #输入绑定的主域名Your domain: vpsmm.comDo you want to add more domain name? (y/n) y #是否绑定其它域名
Enter domain name(example: lnmp.org *.lnmp.org): www.vpsmm.com #输入其它域名
domain list: www.vpsmm.com
Please enter the directory for the domain: vpsmm.com
(Default directory: /home/wwwroot/vpsmm.com): #默认创建的网站文件所在目录
Virtual Host Directory: /home/wwwroot/vpsmm.comAllow 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: vpsmm_user #创建数据库用户名
Your will create a database and MySQL user with same name: vpsmm_user
Please enter password for mysql user vpsmm_user: vpsmmpasswd
Your password: vpsmmpasswd #创建相应密码
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
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
================================================
<p id="lnmp-3"><a href="#lnmp-3">三、自定义伪静态规则
<p >如果lnmp默认的伪静态规则不能满足你的需要,或者,你要自行定义伪静态规则,可以新建一个conf文件,放置于 /usr/local/Nginx/conf 下,在域名配置文件,即:/usr/local/Nginx/conf/vhost/legcloud.com.conf 里引用。
<pre >server
{
Listen 80;
server_name legcloud.com www.legcloud.com; #绑定的域名
index index.HTML index.htm index.PHP default.HTML default.htm default.PHP; #首页文件
root /home/legcloud.com; #网站存放目录
include wordpress.conf; #伪静态规则文件,可自定义成你需要的
location ~ ..(PHP|PHP5)?$
{
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.PHP;
include fcgi.conf;
}
location ~ ..(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ ..(Js|CSS)?$
{
expires 12h;
}
access_log off;
}
<p >修改设置以后,一定要重新载入lnmp或者,重新载入Nginx,以下任决命令都一样:
<pre >/root/lnmp reload #使用lnmp重新载入配置
/etc/init.d/Nginx reload #只重新载入Nginx配置,我一般用这个
<p ID="lnmp-4"><a href="#lnmp-4">四、自定义404、503等常见错误
<p >不管是404还是503等常见错误,还是设置/usr/local/nginx/conf/vhost/legcloud.com.conf文件来完成:
<pre > listen 80;
server_name legcloud.com www.legcloud.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/legcloud.com;
error_page 404 /404.php; #放在这里,可自定义文件名,再重载nginx就可以了
include wordpress.conf;
<p id="lnmp-5"><a href="#lnmp-5">五、判断当前域名并自动301到主域名
<pre >if ($host != 'vpsmm.com' ) {rewrite ^/(.)$ http://www.vpsmm.com/$1 permanent;}判断当前域名,如果不是则自动301到主域名,放置于error_page ...;上下均可。
<p ID="lnmp-6"><a href="#lnmp-6">六、关闭或开启FSO等PHP函数
<p >lnmp最新版,默认禁用了一些函数,例如fso等,可修改/usr/local/PHP/etc/PHP.ini
<pre >disable_functions = passthru,exec,system,chroot,scandir....----这是禁用函数,把不想禁用的删除即可----如果自用主机,最简单的修改方案:
disable_functions =
; passthru,scandir....
<p >修改后,使用/etc/init.d/PHP-fpm restart,重新启动PHP
<p >七、升级PHP和Nginx版本
<pre >cd lnm0.9 #进入lnmp安装目录
./upgrade_Nginx.sh #升级Nginx,只要输入你要升级的版本即可(可见Nginx.org)
./upgrade_PHP.sh #升级PHP,只要输入你要升级的版本即可(可见PHP.net) 总结
以上是内存溢出为你收集整理的使用LNMP常见问题解答全部内容,希望文章能够帮你解决使用LNMP常见问题解答所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)