使用LNMP常见问题解答
使用LNMP常见问题解答
一、LNMP的安装过程详解,注:绿色文字为注释,实际使用过程中没有。
##先要下载,并根据不同系统进行安装:tar zxvf lnmp1.0.tar.gzcd lnmp1.0./centos.sh #如果您是其它系统,则命令改为:./ubuntu.sh 或 debian.sh以上为下载及进入安装过程,以下为安装前简易设置,切记输入个其它域名及牢记mysql密码:
=========================================================================LNMP V1.0 for CentOS/RadHat Linux VPS Written by Licess=========================================================================A tool to auto-compile & install Nginx+MySQL+PHP on Linux ====================================================================================================Please input the root password of mysql:(Default password: root):vpsmm.com #请输入mysql密码===========================MySQL root password:vpsmm.com======================================================Do you want to install the InnoDB Storage Engine?(Default no,if you want please input: y ,if not please press the enter button):INPUT error,The InnoDB Storage Engine will NOT install! #是否安装InnoDB===========================Install PHP 5.3.17,Please input yInstall PHP 5.2.17,Please input n or press Enter(Please input y or n):y #选择php版本You will install PHP 5.3.17===========================Install MySQL 5.5.27,Please input yInstall MySQL 5.1.60,Please input n or press Enter(Please input y or n):y #选择mysql版本You will install MySQL 5.5.27Press any key to start...or Press Ctrl+c to cancelCentOS release 6.3 (Final)#按任意键,设置完成,正式进入安装,预计20-40分钟完成其实所谓的域名绑定,就是通过命令的形式,简易创建一个conf文件到/usr/local/nginx/conf/vhost下面,这个过程完全可以手工创建conf,或者,平时修改目录、域名等,直接修改conf文件,效果完全一样:
/root/vhost.sh #lnmp域名绑定命令=========================================================================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 =========================================================================Please input domain:(Default domain: www.lnmp.org):legcloud.com #输入你要绑定的域名,legcould和www.legcloud要分别绑定===========================domain=legcloud.com===========================Do you want to add more domain name? (y/n)y #是否添加子域名,可以输入y或n,这里输入yType domainname,example(bbs.vpser.net forums.vpser.net luntan.vpser.net):www.legcloud.com #输入你要绑定的其它域名,支持泛解析,例如:*.legcloud.com===========================domain list=www.legcloud.com===========================Please input the directory for the domain:legcloud.com :(Default directory: /home/wwwroot/legcloud.com):/home/legcloud.com #网站存放目录,可默认或自行输入===========================Virtual Host Directory=/home/legcloud.com======================================================Allow Rewrite rule? (y/n)===========================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)===========================n #是否创建日志文件,如果不需要可不用Press any key to start create virtul host...#按任意建继续,以下为一些相关信息,包括创建目录,测试nginx等,如果有错误提示,请一定要认真分析Create Virtul Host directory......set permissions of Virtual Host directory......You select the exist rewrite rule:/usr/local/nginx/conf/wordpress.confTest Nginx configure file......nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is oknginx: configuration file /usr/local/nginx/conf/nginx.conf test is successfulRestart Nginx......=========================================================================Add Virtual Host for LNMP V0.9 , Written by Licess =========================================================================Your domain:legcloud.comDirectory of legcloud.com:/home/legcloud.com=========================================================================如果lnmp默认的伪静态规则不能满足你的需要,或者,你要自行定义伪静态规则,可以新建一个conf文件,放置于 /usr/local/nginx/conf 下,在域名配置文件,即:/usr/local/nginx/conf/vhost/legcloud.com.conf 里引用。
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;}修改设置以后,一定要重新载入lnmp或者,重新载入nginx,以下任决命令都一样:
/root/lnmp reload #使用lnmp重新载入配置/etc/init.d/nginx reload #只重新载入nginx配置,我一般用这个不管是404还是503等常见错误,还是设置/usr/local/nginx/conf/vhost/legcloud.com.conf文件来完成:
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;if ($host != 'vpsmm.com' ) {rewrite ^/(.*)$ http://www.vpsmm.com/$1 permanent;}#判断当前域名,如果不是则自动301到主域名,放置于error_page ...;上下均可。lnmp最新版,默认禁用了一些函数,例如fso等,可修改/usr/local/php/etc/php.ini
disable_functions = passthru,exec,system,chroot,scandir....#----这是禁用函数,把不想禁用的删除即可----如果自用主机,最简单的修改方案:disable_functions =; passthru,exec,system,chroot,scandir....#----设置为全部开启修改后,使用/etc/init.d/php-fpm restart,重新启动php
七、升级PHP和NGINX版本
cd lnm0.9 #进入lnmp安装目录./upgrade_nginx.sh #升级nginx,只要输入你要升级的版本即可(可见nginx.org)./upgrade_php.sh #升级php,只要输入你要升级的版本即可(可见php.net)使用LNMP常见问题解答的更多相关文章
- MySQL同步常见问题解答(自己的小心得)
前几天刚刚注册了博客园,我想写一些技巧性的教程,今天给大家分享一个MySQL同步常见问题解答. Q:如果主服务器正在运行并且不想停止主服务器,怎样配置一个从服务器? A:有多种方法.如果你在某时间点做 ...
- Delphi XE5 常见问题解答
Delphi XE5 常见问题解答 有关于新即时试用的问题吗?请看看 RAD Studio 即时试用常见问答. 常见问题 什么是 Delphi? Embarcadero? Delphi? XE5 是易 ...
- SSL/TLS 高强度加密: 常见问题解答
关于这个模块 mod_ssl 简史 mod_ssl会受到Wassenaar Arrangement(瓦森纳协议)的影响吗? mod_ssl 简史 mod_ssl v1 最早在1998年4月由Ralf ...
- [!!!!!]Inno Setup教程-常见问题解答
[转]Inno Setup教程-常见问题解答 功能 * 翻译 Inno Setup 文字 * 它支持 MBCS (多字节字符集) 吗? * 将来会支持 Windows Installer 吗? ...
- 英特尔® 实感™ SDK 前置摄像头 (F200) 常见问题解答
原文地址 https://software.intel.com/zh-cn/articles/intel-realsense-sdk-faq-for-front-facing-camera-f200? ...
- 我个人有关 Azure 网络 SLA、带宽、延迟、性能、SLB、DNS、DMZ、VNET、IPv6 等的 Azure 常见问题解答
Igor Pagliai(微软) 2014 年 9月 28日上午 5:57 年 11 月 3 年欧洲 TechEd 大会新宣布的内容). 重要提示:这篇文章中我提供的信息具有时间敏感性,因为这些 ...
- 关于CopyU!的常见问题解答
拷优(CopyU!)常见问题解答 本常见问题解答列举了一些常见的疑问及其解释,如果您对CopyU!有任何问题,请您首先查看本解答! 本解答将会保持随时更新! 一.使用篇: 1.问:我的杀毒软件 ...
- genymotion常见问题解答
[转]常见问题解答 很多人喜欢使用Genymotion这款安卓模拟器,但是虽然Genymotion很好用,可是却有各种问题存在哦,下面潇潇就一些常见的Genymotion问题来说下解决方法吧. 为什么 ...
- Linux的常见问题解答和管理技巧
Linux的常见问题解答和管理技巧 一. 如何建立多用户 提醒大家一句,别一直使用root用户,因为root用户在系统中有着至高无上的权力,一不小心就可能破坏系统.比如我们想删除/temp目录下的文件 ...
随机推荐
- Simditor学习--vuejs集成simditor
唠叨 因为项目需要我自己研究了和集成在vue方便以后再使用,详情官方文档在这里.希望大家有好的建议提出让我继续改进. simditor介绍 Simditor 是团队协作工具 Tower 使用的富文本编 ...
- golang实现mysql数据库备份
背景 navicat是mysql可视化工具中最棒的,但是,在处理视图的导入导出方面,它是按照视图名称的字母顺序来处理的,若视图存在依赖,在导入过程中就会报错.前面已经用python写了一个,但在使用过 ...
- CentOS为中文显示
[sudo yum groupinstall chinese-support]命令即可安装
- [thinkphp] 隐藏后台地址
转自 http://document.thinkphp.cn/manual_3_2.html#module_deploy 如果不希望用户直接访问某个模块,可以设置模块映射(对后台的保护会比较实用). ...
- 洛谷P2713 罗马游戏
题目传送门 分析: 好吧,其实没什么好分析的,左偏树裸题. Code: #include<cstdio> #include<cstring> #include<cstdl ...
- 洛谷——P1994 有机物燃烧
P1994 有机物燃烧 题目背景 本来准备弄难点的,还是算了吧 题目描述 输入一种有机物,输出与氧气反应化学方程式中CO2和H2O的系数 输入输出格式 输入格式: 一行,一个字符串,表示有机物 输出格 ...
- RabbitMQ (十三) 集群+单机搭建(window)
拜读了网上很多前辈的文章,对RabbitMQ的集群有了一点点认识. 好多文章都说到,RabbitMQ的集群分为普通集群和镜像集群,有的还加了两种:单机集群和主从集群. 我看来看去,看了半天,怎么感觉, ...
- WHERE 子句中的标量子查询
标量子查询不仅可以用在SELECT 语句的列表中,它还可以用在WHERE 子句中,而且实际应用中子查询很多的时候都是用在WHERE子句中的. 先来看一个简单的例子,我们要检索喜欢“Story”的读者主 ...
- WebForms UnobtrusiveValidationMode 需要“jquery”ScriptResourceMapping——牛腩新闻发布系统
VS2011使用验证控件出现" WebForms UnobtrusiveValidationMode 需要"jquery"ScriptResourceMapping.请添 ...
- luogu P1016 旅行家的预算
题目描述 一个旅行家想驾驶汽车以最少的费用从一个城市到另一个城市(假设出发时油箱是空的).给定两个城市之间的距离D1.汽车油箱的容量C(以升为单位).每升汽油能行驶的距离D2.出发点每升汽油价格P和沿 ...