一、平台搭建在LNMP上,所以应该先搭建LNMP架构
首先建立目录:
[root@VM_0_13_centos ~]# mkdir /usr/local/lnmp
1.首先安装nginx
这里时用的版本是nginx-1.14.0,解压
[root@VM_0_13_centos ~]# tar zxf nginx-1.14.0.tar.gz
[root@VM_0_13_centos ~]# cd nginx-1.14.0/
修改配置文件,使无法看到nginx的具体版本,防止利用版本漏洞恶意破坏
[root@VM_0_13_centos nginx-1.14.0]# vim src/core/nginx.h
#define NGINX_VER "nginx/"
添加配置,首先下载gcc
[root@VM_0_13_centos nginx-1.14.0]# yum install -y gcc
[root@VM_0_13_centos nginx-1.14.0]# ./configure --prefix=/usr/local/lnmp/nginx --with-threads --with-file-aio --with-http_ssl_module --with-http_stub_status_module --user=nginx --group=nginx
出现错误:
./configure: error: the HTTP rewrite module requires the PCRE library.

解决方法:
[root@VM_0_13_centos nginx-1.14.0]# yum install pcre-devel -y
再次执行
出现错误:
./configure: error: SSL modules require the OpenSSL library.
解决办法:
[root@VM_0_13_centos nginx-1.14.0]# yum -y install openssl openssl-devel
再次执行,成功!

编译安装:
[root@VM_0_13_centos nginx-1.14.0]# make && make install
成功!

修改配置文件并进行测试:
[root@VM_0_13_centos nginx-1.14.0]# vim /usr/local/lnmp/nginx/conf/nginx.conf
1
2 user nginx nginx;
3 worker_processes auto;
[root@VM_0_13_centos sbin]# useradd nginx
检查配置文件是否出错
[root@VM_0_13_centos nginx-1.14.0]# cd /usr/local/lnmp/nginx/sbin
[root@VM_0_13_centos sbin]# ./nginx -t
查看版本
[root@VM_0_13_centos sbin]# ./nginx -v
nginx version: nginx/
查看添加配置时使用参数
[root@VM_0_13_centos sbin]# ./nginx -V
nginx version: nginx/
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/lnmp/nginx --with-threads --with-file-aio --with-http_ssl_module --with-http_stub_status_module --user=nginx --group=nginx

制作软链接并测试
[root@VM_0_13_centos sbin]# ln -s /usr/local/lnmp/nginx/sbin/nginx /usr/local/sbin/
[root@VM_0_13_centos sbin]# nginx -t
nginx: the configuration file /usr/local/lnmp/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/lnmp/nginx/conf/nginx.conf test is successful
可以使用

启动nginx并查看端口
[root@VM_0_13_centos sbin]# nginx
[root@VM_0_13_centos sbin]# netstat -antlp

测试nginx的工作是否正常,输入ip

正常工作
2.安装php
这里使用的是php-5.6.35
首先解压
[root@VM_0_13_centos ~]# tar jxf php-5.6.35.tar.bz2
解决依赖性
<
本文详细介绍了在CentOS环境下从零开始搭建LNMP(Linux+Nginx+MySQL+PHP)架构的过程,并成功安装了ShopXO电商系统。包括解决依赖、配置参数、编译安装等关键步骤。
&spm=1001.2101.3001.5002&articleId=98513333&d=1&t=3&u=e752ffa410ea41cc9eabd3f8f8d31ea5)
1157

被折叠的 条评论
为什么被折叠?



