阿里云服务器部署LEMP实战 2019-06-24
1. 云服务器初始化为Linux server,牢记密码。SSH登陆后查验服务器版本:
引用
# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.2.1511 (Core)
Release: 7.2.1511
Codename: Core
至此,LEMP的L部分完成。
2. 参考文档中有两项关闭设置,我检查了一下,默认都是关闭状态,所以跳过这一步。详情见下面参考文档。
3. 安装Nginx
引用
yum -y install nginx
查看Nginx版本:
引用
# nginx -v
nginx version: nginx/1.12.2
4. 因为PHP和Nginx配合用,所以先安装PHP,最后安装MySQL
4.1 更新yum源
引用
yum install -y http://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/ius-release-1.0-15.ius.centos7.noarch.rpm
引用
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
4.2 安装PHP 7.0
引用
yum -y install php70w-devel php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-pdo.x86_64 php70w-mysqlnd php70w-fpm php70w-opcache php70w-pecl-redis php70w-pecl-mongo
验证安装版本号:
引用
# php -v
PHP 7.0.33 (cli) (built: Dec 6 2018 22:30:44) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.33, Copyright (c) 1999-2017, by Zend Technologies
5. 配置Nginx
配置Nginx 部分颇费周折,主要是参阅参考文档,但需要做一些更改。我的nginx.conf 如下.
引用
/etc/nginx/nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /var/www/html;
index index.html index.php;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
# set expiration of assets to MAX for caching
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
expires max;
log_not_found off;
}
location / {
# Check if a file or directory index file exists, else route it to index.php.
try_files $uri $uri/ /index.php;
}
location ~* \.php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi.conf;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}
重启nginx
6. 最后,写一个index.php 放到/var/www/html 下面:
<?php echo phpinfo(); ?>
可以测试访问。
7. MySQL 安装配置相对简单,略了。
参考:
https://help.aliyun.com/document_detail/97251.html
分享到:
相关推荐
LEMP构建高性能的WEB服务器,全面性的建站文档,
新版的介绍: 1.提供完整的配置脚本下载:[url]http://www.linuxtone.org/lemp/scripts.tar.gz[/url] 2.提供NGINX常见配置范例含(虚拟...希望你能通过本文快速构建一个高性能的WEB服务器!欢迎在Linuxtone开启讨论!
阿里云 oss java源码 本脚本使用shell编写,为了快速部署LEMP / LAMP / LNMP / LNMPA / LTMP (Linux、Nginx/Tengine/OpenResty、生产环境下MySQL/MariaDB/Percona、PHP、JAVA),适用于CentOS 6 ~ 7(包括 redhat)...
阿里云 oss java源码 本脚本使用shell编写,为了快速部署LEMP / LAMP / LNMP / LNMPA / LTMP (Linux、Nginx/Tengine/OpenResty、生产环境下MySQL/MariaDB/Percona、PHP、JAVA),适用于CentOS 6 7(包括红帽),...
LEMP构建高性能WEB服务器(第三版).pdf
LEMP构建高性能WEB服务器(第三版)配置脚本
LEMP 是个缩写,代表一组软件包(L:Linux OS,E:Nginx 网络服务器,M:MySQL/MariaDB 数据库和 P:PHP 服务端动态编程语言),它被用来搭建动态的网络应用和网页。 (LCTT 译注:为何采用 LEMP 而不是 LNMP 的缩写...
阿里云 oss java源码 本脚本使用shell编写,为了快速部署LEMP / LAMP / LNMP / LNMPA / LTMP (Linux、Nginx/Tengine/OpenResty、生产环境下MySQL/MariaDB/Percona、PHP、JAVA),适用于CentOS 6 ~ 7(包括 redhat)...
刚明白就感觉kjdfgiofklujasdki跟对方考虑送家里家阿哥卡拉胶
平台搭建环境: CentOS5.2 32/x86_64 GNU/Linux (32/64 操作系统均通过,推荐使用 64 位操作系统) 目标:构建高性的 LEMP 环境提供 WEB 服务
阿里云 oss java源码 本脚本使用shell编写,为了快速部署LEMP / LAMP / LNMP / LNMPA / LTMP (Linux、Nginx/Tengine/OpenResty、生产环境下MySQL/MariaDB/Percona、PHP、JAVA),适用于CentOS 6 ~ 7(包括 redhat)...
Cipi是基于Laravel的云服务器控制面板,支持Digital Ocean,AWS,Vultr,Google Cloud,Linode,Azure和其他VPS。 它带有nginx,Mysql,多个PHP-FPM版本,多个用户,Supervisor,Composer,npm,免费的Let's Encrypt...
快速部署Linux
CentOS 5.5 LNMP架构打架详细文档
阿里云 oss java源码 本脚本使用shell编写,为了快速部署LEMP / LAMP / LNMP / LNMPA / LTMP (Linux、Nginx/Tengine/OpenResty、生产环境下MySQL/MariaDB/Percona、PHP、JAVA),适用于CentOS 6 ~ 7(包括 redhat)...
阿里云 oss java源码 本脚本使用shell编写,为了快速部署LEMP / LAMP / LNMP / LNMPA / LTMP (Linux、Nginx/Tengine/OpenResty、生产环境下MySQL/MariaDB/Percona、PHP、JAVA),适用于CentOS 6 ~ 7(包括 redhat)...
最近由于项目需求,将服务器从CentOS6升级到CentOS7,对应的PHP版本也升级到PHP5.6。我们熟悉的有LEMP环境一键安装包,但是本文我们将单独安装各个组件模块,并搭建一个完整的PHP运行平台。 我们常说的LNMP环境是指...
然后我使用 Ansible playbook 安装具有外部和内部网络的多服务器 LEMP 堆栈 要运行它,首先根据以下说明准备您的系统以使用 Vagrant: : 克隆此存储库并从命令行运行 vagrant up 这将需要几分钟,但它会导致三个...
k8s-lemp:Kubernetes集群中的LEMP堆栈
docker-lemp-stack