GVKun编程网logo

阿里云 Lnmp 环境安装(阿里云一键安装web环境)

20

如果您对阿里云Lnmp环境安装和阿里云一键安装web环境感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解阿里云Lnmp环境安装的各种细节,并对阿里云一键安装web环境进行深入的分析,此外还有关于

如果您对阿里云 Lnmp 环境安装阿里云一键安装web环境感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解阿里云 Lnmp 环境安装的各种细节,并对阿里云一键安装web环境进行深入的分析,此外还有关于CentOS 6.5下LNMP环境安装(yum方式)、CentOs 下的 lnmp 环境安装 PHP 的 APCU 拓展、CentOS7 LNMP环境安装wordpress、CentOs7下lnmp环境安装的实用技巧。

本文目录一览:

阿里云 Lnmp 环境安装(阿里云一键安装web环境)

阿里云 Lnmp 环境安装(阿里云一键安装web环境)

趁最近失业的这段空挡,来搭建一个自己的博客。 环境:阿里云 ECS 云服务器 OS:centos 64 位 安装方法:二进制包手动编译安装 新建用户组

groupadd -r nginx

新建用户

useradd -s /sbin/nologin -g nginx -r nginx

这里有一个问题为甚么要新建用户 下载 nginx-1.10.1 的二进制包 这里是地址

wget http://nginx.org/download/nginx-1.10.1.tar.gz

解压到 tmp 目录

tar -xvf nginx-1.10.1.tar.gz

x 是 extract 简写,提取 v 是 verbose 简写,展示文件压缩或解压缩的过程 f 是 file 简写,文件名 以上这些可以查看手册得知(tar --help 或 man tar) 进入解压好的 nginx-1.10.1 文件夹

cd nginx-1.10.1

开始预编译

./configure

报错,信息如下

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

里面的信息提示说 HTTP 重写模块需要 PCRE 库,系统给了三种解决方案

  1. 使用 --without-http_rewrite_module 来禁掉重写模块
  2. 安装 PCRE 库
  3. 使用 --with-pcre=<path> 静态 build PCRE 库进 nginx 我们选第二种 PCRE 官网地址 下载最新版的 PCRE
cd /tmp
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.bz2

解压

tar -xvf pcre-8.37.tar.bz2

预编译

 cd pcre-8.37
 ./configure 

编译 && 安装

make && make install

清除编译安装后的垃圾文件

make clean

继续预编译 nginx-1.10.1

cd /tmp/nginx-1.10.1
./configure

又发现报错 ./configure: error: the HTTP gzip module requires the zlib library. You can either disable the module by using --without-http_gzip_module option, or install the zlib library into the system, or build the zlib library statically from the source with nginx by using --with-zlib=<path> option. 这和上次的报错信息一样,只不过模块换成了 zlib 下载 zlib

wget http://zlib.net/zlib-1.2.8.tar.gz

解压

tar -xvf zlib-1.2.8.tar.gz

编译安装

cd zlib-1.2.8
./configure 
make && make install
make clean

继续编译 nginx-1.10.1

cd /tmp/nginx-1.10.1
./configure

又报错了,报错信息如下

./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.

提示缺少 openssl 库 下载 openssl 官网地址

wget https://www.openssl.org/source/openssl-1.0.1t.tar.gz

解压 安装

tar -xvf openssl-1.0.1t.tar.gz
cd openssl-1.0.1t
./config
make depend

这里安装过程有些不一样 再去编译 nginx-1.10.1 产生和上次一样的报错 无奈,尝试多次无果,于是用 yum 装了一遍

yum -y install openssl openssl-devel

ok 继续编译 ngnix-1.10.1

./configure \
--prefix=/usr \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx/nginx.pid \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/tmp/nginx/client \
--http-proxy-temp-path=/var/tmp/nginx/proxy \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi \
--with-http_stub_status_module

ok 没报错

make && make install

也 ok

/usr/sbin/nginx

启动失败,报错信息

/usr/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

libpcore.so.1 打不开,解决办法

ln -s /usr/local/lib/libpcre.so.1 /lib64

再次启动

/usr/sbin/nginx

失败,报错信息

nginx: [emerg] mkdir() "/var/tmp/nginx/client" failed (2: No such file or directory)

创建 "/var/tmp/nginx/client" 文件夹失败(权限不够导致),解决办法

mkdir -p /var/tmp/nginx/{client,proxy,fastcgi,uwsgi,scgi}

再次启动

/usr/sbin/nginx

成功显示 Wellcom to nginx! http://121.40.173.143/ 源码包安装最新 php-7.0.8 最新版 解压 预编译 安装 配置

参考: http://blog.csdn.net/dazhi_100/article/details/17143213 http://www.nginx.cn/install http://www.cnblogs.com/suihui/archive/2013/04/13/3018557.html http://www.qttc.net/201208194.html http://www.tuicool.com/articles/uEre6fr

CentOS 6.5下LNMP环境安装(yum方式)

CentOS 6.5下LNMP环境安装(yum方式)

一、安装环境

LNMP:linux(centos6.5)+ Nginx(1.10.2)+MysqL(5.1.73)+PHP(5.3.3)

注意安装顺序,先Nginx,然后MysqL,最后PHP,因为PHP需要安装的扩展比较多


二、linux系统环境准备

1、centos中集成了yum工具包,所以可以使用yum命令快速安装需要的服务

查看安装包信息:yum list |grep PHP #查看PHP包信息

安装对应的包:yum install PHP #安装PHP包

其他相关命令……

2、centos6.5内部命令,安装服务之后

查看服务状态:netstat -tunpl #查看已经运行的服务及端口信息

注:如果netstat和ifconfig命令不能使用,需要先安装net-tools工具

yum install net-tools

3、chkconfig 命令

查看所有服务:chkconfig --list

添加服务:chkconfig --add MysqLd

删除:chkconfig --del MysqLd

设置自启:chkconfig --levels 235 MysqLd on/off


三、安装Nginx

安装比较简单:yum install Nginx

启动Nginx:service Nginx start

设置开机自启:chkconfig --levels 235 Nginx on

注:如果没有Nginx yum源,可以自己手动添加一个,然后执行yum安装

添加yum源方法:

1、创建yum源文件:vim /etc/yum.repos.d/Nginx.repo

2、编辑文件内容:

[Nginx]
name=Nginx repo
baseurl=http://Nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1


四、安装MysqL

安装:yum install MysqL MysqL-server

启动:service MysqLd start

设置自启:chkconfig --levels 235 MysqLd on

设置MysqL账户root密码:MysqL_secure_installation,

设置密码之后,全部选y


五、安装PHP

安装:yum install PHPPHP-fpm PHP-MysqL PHP-common PHP-gd PHP-mbstring PHP-mcrypt PHP-devel PHP-odbc PHP-pear PHP-xml PHP-xmlrpc PHP-imap PHP-ldap

注:这里安装PHP-fpm,因为Nginx本身不解析PHP,PHP5.3.3开始集成了PHP-fpm这个解析器,所以直接安装该扩展即可

启动PHP-fpm:service PHP-fpm start

设置自启:chkconfig --levels 235 PHP-fpm on


六、配置Nginx for PHP

1、Nginx配置文件位置

Nginx.conf /etc/Nginx/Nginx.conf


可以看到,所有的server配置项都是在/etc/Nginx/conf.d 目录下


2、配置 test.conf

#
# The test server
#

server {
    #web端口监听
    listen       80 default_server;         
    listen       [::]:80 default_server;    
    #域名
    server_name  127.0.0.1;                 
    #文件路径
    root         /usr/www/test;             
	
    # Load configuration files for the default server block.
    include /etc/Nginx/default.d/*.conf;

    #入口文件
    location / {
	index index.PHP                     
	try_files $uri $uri/ /index.PHP$is_args$args;      
    }
    #PHP解析,监听PHP-fpm9000端口
    location ~ \.PHP$ {                     
        try_files $uri =404;
        include fastcgi.conf;
        fastcgi_pass 127.0.0.1:9000;
    }

}

配置推荐: https://huoding.com/2013/10/23/290

CentOs 下的 lnmp 环境安装 PHP 的 APCU 拓展

CentOs 下的 lnmp 环境安装 PHP 的 APCU 拓展

  1. 下载源码,解压编译
 cd /homw/download/
 wget http://pecl.php.net/get/apcu-5.1.17.tgz
 tar zxvf apcu-5.1.17.tgz
 cd apcu-5.1.17
 phpize
 ./configure --with-php-config=/usr/local/php/bin/php-config
 make && make install
  1. 配置 php.ini
 vim /usr/local/php/etc/php.ini
 lnmp reload php-fpm
  1. 查看是否安装成功
  • phpinfo () 里搜索 apcu
  • APCu Support Enabled

CentOS7 LNMP环境安装wordpress

CentOS7 LNMP环境安装wordpress

CentOS7LNMP环境安装wordpress

前言

上一篇文章配置好了LNMP环境,现在开始安装wordpress并且迁移之前的数据。

需要使用到的工具有xshell6,xftp。

建立数据库

mysql -uroot -p     # 用之前设置的密码登陆mysql
mysql>create database wordpress;    # 创建wordpress数据库
mysql>use wordpress;    #切换到wordpress数据库
mysql>exit  # 退出mysql

安装wordpress

新建文件夹wp

mkdir wp
cd wp
yum -y install wget unzip net-tools
wget http://wordpress.org/latest.zip
这里下载了最新版本的,为了防止与PHP版本不兼容,大家可以去这里自行选择合适的wordpress版本下载

创建wordpress安装目录

mkdir /var/www/wordpress

解压并将文件拷贝到/var/www/wordpress目录下

unzip -q latest.zip
cp -rf wordpress/* /var/www/wordpress/
这个目录不唯一,需要和nginx配置的网站根目录保持一致即可

配置wordpress

修改wordpress配置

cd /var/www/wordpress
cp wp-config-sample.php wp-config.php 
vi wp-config.php

打开文件后,按i键或insert键进入编辑模式,将其修改为以下格式(其中wordpressdb为数据库名称,wordpressuser为数据库用户名,123456为数据库密码)

// * MySQL settings - You can get this info from your web host * // 
/* The name of the database for WordPress / 
define(‘DB_NAME’, ‘wordpressdb’);

/* mysql database username / 
define(‘DB_USER’, ‘wordpressuser’);

/* MySQL database password / 
define(‘DB_PASSWORD’, ‘123456’);

修改文件夹权限

chown -R nginx:nginx /var/www/wordpress/
chmod -R 755 /var/www/wordpress/
mkdir -p /var/www/wordpress/wp-content/uploads
chown -R :nginx /var/www/wordpress/wp-content/uploads
也可以简单点 chmod 777 wordpress

重启相关服务

systemctl restart php-fpm.service
systemctl restart nginx.service
service mysqld restart

Wordperss个人配置

好了,现在你的wordpress已经配置完毕,你可以通过域名来继续你的wordpress安装登录 htttp://x.x.x.x/访问你的博客(x.x.x.x为你的服务器公网IP),按照自己的喜好进行相关的设置。

迁移数据

迁移数据一定要等Wordpress安装成功之后再迁移,迁移前要将网站数据进行备份。

备份什么?

  1. 备份数据库。在原服务器中备份数据库,数据库中存储的是我们写的文章,所以一定要备份!
  2. 备份服务器数据。服务器中的数据不需要全部备份,只要备份重要数据即可。

wp-contentthemes下存放的是主题目录
wp-contentplugins下存放的是插件目录
wp-contentuploads下存放的是附件目录(包括图片)
只需要将这三个目录备份即可!

怎么恢复?

  1. 安装WordPress:在新服务器上安装WordPress。
  2. 恢复网站文件:安装后将备份的三个文件夹主题、插件以及附件恢复到wp_content目录下。这里可以使用xftp工具。(注意!这里不是直接覆盖,我直接覆盖就悲剧了,网站打不开了,辛亏我有备份,挑选需要的内容恢复过去即可)
  3. 恢复数据库:将备份的数据库文件还原到新建的数据库中。
欢迎转载,转载请注明出处!
独立域名博客:flywill.cn
欢迎关注公众微信号:Java小镇V
分享自己的学习 & 学习资料 & 生活
想要交流的朋友也可以加微信号备注入群:EscUpDn

CentOs7下lnmp环境安装

CentOs7下lnmp环境安装

1. 虚拟机软件安装CentOs

1-1. CentOs下载:

http://mirrors.163.com/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1804.iso

地址:http://mirrors.163.com/centos...

1-2. 百度网盘:https://pan.baidu.com/s/1boIFOC3

密码:v8h3

1-3. 官方下载地址:

https://www.centos.org/download/

2. 准备工作

2-1 查看ip

  1. ifconfig
  2. ip addr
  3. vi /etc/sysconfig/network-scripts/ifconfig-en3

    [root@localhost ~]# cd /etc/sysconfig/network-scripts
    [root@localhost network-scripts]# vi ifcfg-enp0s3

修改ifcfg-enp0s3

    TYPE=Ethernet
    PROXY_METHOD=none
    BROWSER_ONLY=no
    BOOTPROTO=dhcp
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=no
    IPV6INIT=yes
    IPV6_AUTOCONF=yes
    IPV6_DEFROUTE=yes
    IPV6_FAILURE_FATAL=no
    IPV6_ADDR_GEN_MODE=stable-privacy
    NAME=enp0s3
    UUID=f0db1d0a-0102-48c0-8581-d0834f11e4be
    DEVICE=enp0s3
    ONBOOT=yes//no改为yes

执行:service network restart
(此时执行ip addr 网络就是通的)

关机-桥接-启动,此时与电脑网络连接是没有关系的!

2-2 注意:将设置中的网络改为:网络桥接

reboot//重启
yum install net-tools
ifconfig//192.168.1.3

3、替换默认源

  1. wget (下载默认没有安装)
  2. yum install wget
  3. http://mirrors.163.com/.help/... (忽略)
  4. mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
  5. [root@localhost ~]# cd /etc/yum.repos.d/
  6. [root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/...
  7. 运行以下命令生成缓存
    yum clean all
    yum makecache

3-1. 安装vim

1:[root@localhost yum.repos.d]# yum install vim
2:安装成功后的验证
[root@localhost yum.repos.d]# vim /etc/sysconfig/network-scripts/ifcfg-enp0s3
可以打开即为正常

关于阿里云 Lnmp 环境安装阿里云一键安装web环境的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于CentOS 6.5下LNMP环境安装(yum方式)、CentOs 下的 lnmp 环境安装 PHP 的 APCU 拓展、CentOS7 LNMP环境安装wordpress、CentOs7下lnmp环境安装等相关知识的信息别忘了在本站进行查找喔。

本文标签: