大佬教程收集整理的这篇文章主要介绍了使用LNMP常见问题解答,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
<pre class="brush:sHell;">##先要下载,并根据不同系统进行安装:
wget -c http://soft.vpser.net/lnmp/lnmp1.5.tar.gz
tar zxvf lnmp1.5.tar.gz
cd lnmp1.5
./install.sh #开始进行安装操作
<p class="pblock">以上为下载及进入安装过程,以下为安装前简易设置,切记输入个其它域名及牢记MysqL密码:
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 class="brush:sHell;">#1.2版本以后,不需要再执行/root/lnmp了,可以在任意位置执行lnmp命令
lnmp #会出现一些提示信息
lnmp restart #重启
lnmp vhost add #添加网站绑定
lnmp database add #添加数据库信息
<p class="yahei pxtitle" ID="lnmp-2"><a href="#lnmp-2">二,域名绑定详解
<pre class="brush:sHell;">lnmp vhost add #执行lnmp添加网站命令
+-------------------------------------------+
| Manager for LNMP,Written by Licess |
+-------------------------------------------+
Please enter domain(example: www.lnmp.org): vpsmm.com #输入绑定的主域名
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
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 class="yahei pxtitle" id="lnmp-3"><a href="#lnmp-3">三、自定义伪静态规则
<pre class="brush:sHell;">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 ~ .@H_489_167@.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
LOCATIOn ~ ..(Js|CSS)?$
{
expires 12h;
}
access_log off;
}
<p class="pblock">修改设置以后,一定要重新载入lnmp或者,重新载入Nginx,以下任决命令都一样:
<pre class="brush:sHell;">/root/lnmp reload #使用lnmp重新载入配置
/etc/init.d/Nginx reload #只重新载入Nginx配置,我一般用这个
<p class="yahei pxtitle" ID="lnmp-4"><a href="#lnmp-4">四、自定义404、503等常见错误
<p class="pblock">不管是404还是503等常见错误,还是设置/usr/local/nginx/conf/vhost/legcloud.com.conf文件来完成:
<pre class="brush:sHell;"> 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 class="yahei pxtitle" id="lnmp-5"><a href="#lnmp-5">五、判断当前域名并自动301到主域名
<pre class="brush:sHell;">if ($host != 'vpsmm.com' ) {rewrite ^/(.@H_489_167@)$ http://www.vpsmm.com/$1 peRMANent;}
<p class="yahei pxtitle" ID="lnmp-6"><a href="#lnmp-6">六、关闭或开启FSO等php函数
<pre class="brush:sHell;">disable_functions = passthru,exec,system,chroot,scandir....
disable_functions =
; passthru,scandir....
<p class="pblock">修改后,使用/etc/init.d/php-fpm restart,重新启动php
<pre class="brush:sHell;">cd lnm0.9 #进入lnmp安装目录
./upgrade_Nginx.sh #升级Nginx,只要输入你要升级的版本即可(可见Nginx.org)
./upgrade_php.sh #升级php,只要输入你要升级的版本即可(可见php.net)
以上是大佬教程为你收集整理的使用LNMP常见问题解答全部内容,希望文章能够帮你解决使用LNMP常见问题解答所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。