使用LNMP常见问题解答

<p class="yahei pxtitle">一、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密码:


<pre class="brush:shell;">+------------------------------------------------------------------------+
| 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.60

Please 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.

按任意键,设置完成,正式进入安装,预计20-40分钟完成

<p class="pblock">常见lnmp管理命令:


<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">二,域名绑定详解


<p class="pblock">其实所谓的域名绑定,就是通过命令的形式,简易创建一个conf文件到/usr/local/nginx/conf/vhost下面,这个过程完全可以手工创建conf,或者,平时修改目录、域名等,直接修改conf文件,效果完全一样:


<pre class="brush:shell;">lnmp vhost add #执行lnmp添加网站命令
+-------------------------------------------+
| Manager for LNMP,Written by Licess |
+-------------------------------------------+
Please enter domain(example: www.lnmp.org): vpsmm.com #输入绑定的主域名

Your domain: vpsmm.com

Do 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.com

Allow 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

Restart Nginx......
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 class="yahei pxtitle" id="lnmp-3"><a href="#lnmp-3">三、自定义伪静态规则


<p class="pblock">如果lnmp默认的伪静态规则不能满足你的需要,或者,你要自行定义伪静态规则,可以新建一个conf文件,放置于 /usr/local/nginx/conf 下,在域名配置文件,即:/usr/local/nginx/conf/vhost/legcloud.com.conf 里引用。


<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 ~ .
.(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 ^/(.
)$ http://www.vpsmm.com/$1 permanent;}

判断当前域名,如果不是则自动301到主域名,放置于error_page ...;上下均可。

<p class="yahei pxtitle" id="lnmp-6"><a href="#lnmp-6">六、关闭或开启FSO等php函数


<p class="pblock">lnmp最新版,默认禁用了一些函数,例如fso等,可修改/usr/local/php/etc/php.ini


<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


<p class="yahei pxtitle">七、升级PHP和NGINX版本


<pre class="brush:shell;">cd lnm0.9 #进入lnmp安装目录
./upgrade_nginx.sh #升级nginx,只要输入你要升级的版本即可(可见nginx.org)
./upgrade_php.sh #升级php,只要输入你要升级的版本即可(可见php.net)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


安装开始...1.打开“https://dev.mysql.com/downloadsepo/yum/”下载Mysql源      将下载好的mysql源上传linux服务器 2.yumlocalinstallmysql80*#安装源 centos7中默认安装的是mariadb数据库,如果想要安装mysql,首先要移除mariadb;
安装Helm3#官网下载慢#wgethttps://get.helm.sh/helm-v3.5.4-linux-amd64.tar.gzwgethttp://qiniu.dev-share.top/helm-v3.5.4-linux-amd64.tar.gztar-zxvfhelm-v3.5.4-linux-amd64.tar.gzcplinux-amd64/helm/usr/local/bin#查看helmclient版本helmversion
通过Linux命令行启动用的指令:systemctlstartmariadb.service反馈:Failedtostartmariadb.service:Unitmariadb.servicenotfound.MariaDB简介MariaDB是MySQL的一个分支,MariaDB打算保持与MySQL的高度兼容性,确保具有库二进制奇偶校验的直接替换功能,以及与MySQLAPI和命令
InstallingMariaDBServer10.4TodeployMariaDBCommunityServer10.4onRHEL7orCentOS7,firstdownloadandusethe mariadb_repo_setup scripttoconfiguretheMariaDBrepositoriesforYUM:$sudoyuminstallwget$wgethttps://downloads.mariadb.com/
阅读目录一什么是存储引擎二mysql支持的存储引擎三使用存储引擎一什么是存储引擎mysql中建立的库--> 文件夹库中建立的表--> 文件现实生活中我们用来存储数据的文件有不同的类型,每种文件类型对应各自不同的处理机制:比如处理文本用txt类型,处理表格用excel,处理图片
1、安装MariaDB安装命令yum-yinstallmariadbmariadb-server安装完成MariaDB,首先启动MariaDBsystemctlstartmariadb设置开机启动systemctlenablemariadb[root@node1~]#systemctlenablemariadbCreatedsymlinkfrom/etc/systemd/system/multi-user.target.wants/m
Centos7.5 刚安装的mariadb数据库报错报错:ERROR1045(28000):Accessdeniedforuser'root'@'localhost'(usingpassword:NO)原因一:没有启动数据库解决方法:systemctlstartmariadbsystemctlenablemariadb原因二:未知解决方法:[root@db01~]#
基于YUM安装的mariadb多实例.=================================================================1.yum安装mariadb-server包#yuminstallmariadb-server2.创建多实例对应的目录结构#mkdir/mysql/{3306,3307,3308}/{data,etc,socket,log,bin,pid}-pv#tree/mysql//mysql/
一、系统环境[root@localhost~]#cat/etcedhat-releaseCentOSLinuxrelease7.6.1810(Core)二、mysql安装#yuminstallmysqlmysql-servermysql-devel安装mysql-server失败,如下图:[root@localhost~]#yuminstallmysql-serverLoadedplugins:fastestmirrorLoadingm
数据库的选择两大点是:开源和跨平台,满足这三点MySQL、MongoDB和MariaDB。其中MariaDB是MySQL的分支,也是它的进阶产品,未来很有可能替代MySQL。与MySQL相比较,MariaDB更强的地方在于:Maria 存储引擎PBXT存储引擎XtraDB 存储引擎FederatedX 存储引擎更快的复制查询处理线
使用Navicat连接数据库时出现了 HostxxxisnotallowedtoconnecttothisMariaDbserver的情况。发现了是因为授权的问题,使得连接权限受阻。所以,只需要进入数据库中,给予其权限即可。具体解决代码如下:[root@localhost~]#mysql-uroot-pEnterpassword:#首先进入mys
1.临时表当绘画结束时,临时表会自动销毁,无法用showtables查看临时表。MariaDB[jason]>createtemporarytabletmp(prochar(30),citychar(30));QueryOK,0rowsaffected(0.01sec)MariaDB[jason]>insertintotmpvalues('shanghai','shanghai');QueryOK,1
为了看阳光我来到世上数据库介绍数据库是一个存放数据的仓库,目前市面上最流行的数据库大致氛围的两种,一种叫做关系型数据库,一种叫做非关系型数据库,而关系型数据库近期流行的即为mysql,mysql原本是一个开源的数据库后被oracle公司收购,开始进行服务收费,因此,市面上大多数免费
1,Linux上的mysql MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可。开发这个分支的原因之一是:甲骨文公司收购了MySQL后,有将MySQL闭源的潜在风险,因此社区采用分支的方式来避开这个风险。MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松
启动Mariadb前提需安装mariadb-server-安装mariadb-serveryuminstall-ymariadb-server-启动服务systemctlstartmariadb.service-添加到开机启动systemctlenablemariadb.service-安全设置,以及修改数据库管理员密码mysql_secure_installation-启
1、查看是否安装及可用安装:yumlist|grepmaria2、安装maria(依赖其他几个安装包):yuminstallmariadb-server.x86_64输入'y'继续安装直到安装结束3、检查是否安装:4、安装完后登录提示错误:mysql-uroot-p是由于安装完但是并未启动maria服务5、启动maria有以下几种方法:system
通过yum安装mariadb,并配置MySQL主从服务器主服务器:192.168.10.11从服务器:192.168.10.12#!/bin/bash#====================================================#Author:Mr.Song#CreateDate:2019-02-21#Description:autoconfigMySQLmaster&slave#=====================
实验:实现基于SSL加密的主从复制实验步骤:环境:三台主机,一台CA:200,一台master:150,一台slave:100平时都是在CA上帮用户生成私钥,在服务器上做的1CA,master,slave的证书相关文件mkdir/etc/my.cnf.d/sslcd/etc/my.cnf.d/sslopensslgenrsa2048>cakey.pemopensslreq-new-x509-k
MariaDB[db1]>select*fromstudent;+----+------+-----+--------+-------+|id|name|age|gender|phone|+----+------+-----+--------+-------+|1|a|20|m|119||2|b|20|m|120||3|c|20|m|110
过年了,在老家闲余时间想敲敲代码,发现在安装mariaDb的时候一直报错错误信息:Service‘MySQL’(MySQL)Faildtostart,Verifythatyouhavesuffcientprivilegestostartsystemservices.服务的MySQL(MySQL)启动错误,确认你有权限启动系统服务。记得多年前在使用sqlserver数