Git Product home page Git Product logo

lnmp's Introduction

CentOS 7 YUM 安装 LNMP 环境

CentOS 7 YUM Installation: Nginx 1.8/1.9 + MySQL 5.5/5.6/5.7 + PHP 5.5/5.6/7.0

1、主要目录

站点: /home/wwwroot/

备份: /home/backup/

MySQL 数据: /home/userdata/

MySQL 配置: /etc/my.cnf.d/

Nginx 配置(启用): /etc/nginx/conf.d/

Nginx 配置(禁用): /etc/nginx/conf.d.stop/

PHP 配置(启用): /etc/php-fpm.d/

PHP 配置(禁用): /etc/php-fpm.d.stop/

phpMyAdmin 配置: /etc/phpMyAdmin/

SVN 配置: /var/svn/repos/

2、安装

建议安装 CentOS 7 Minimal (最小化安装) 后再使用本脚本安装环境

# 安装 wget 和 unzip
yum install -y wget unzip

# 下载安装包
wget https://github.com/maicong/LNMP/archive/master.zip

# 解压安装包
unzip master.zip && cd LNMP-master

# 执行安装命令
bash lnmp.sh

# 如果想查看安装日志,可以将 log 输出到指定文件
# bash lnmp.sh 2>&1 | tee lnmp.log

3、服务管理

# 启动 MySQL
systemctl start mysqld.service

# 停止 MySQL
systemctl stop mysqld.service

# 重启 MySQL
systemctl restart mysqld.service

# 启动 PHP
systemctl start php-fpm.service

# 停止 PHP
systemctl stop php-fpm.service

# 重启 PHP
systemctl restart php-fpm.service

# 启动 Nginx
systemctl start nginx.service

# 停止 Nginx
systemctl stop nginx.service

# 重启 Nginx
systemctl restart nginx.service

# 启动 SVN
systemctl start svnserve.service

# 停止 SVN
systemctl stop svnserve.service

# 重启 SVN
systemctl restart svnserve.service

4、站点管理

service vhost (start,stop,list,add,edit,del,exit) <domain> <server_name> <index_name> <rewrite_file> <host_subdirectory>

参数说明

  • start 启动

  • stop 停止

  • list 列出

  • add 添加

  • edit 编辑

  • del 删除

  • exit 什么都不做

  • <domain> 标识名称,默认:domain

  • <server_name> 域名列表,默认:domain.com,www.domain.com

  • <index_name> 首页文件,默认:index.html,index.htm,index.php

  • <rewrite_file> 伪静态规则文件,保存在 /etc/nginx/rewrite/,默认:nomal.conf

  • <host_subdirectory> 是否支持子目录绑定,on 或者 off,默认 off

参数示例

# 添加一个标识为 `mysite`,域名为 `mysite.com` 的站点
service vhost add mysite mysite.com

# 启动标识为 `mysite` 的站点
service vhost start mysite

# 停止标识为 `mysite` 的站点
service vhost stop mysite

# 编辑标识为 `mysite` 的站点
service vhost edit mysite

# 删除标识为 `mysite` 的站点
service vhost del mysite

# 列出所有站点
service vhost list

5、SVN 安装

项目名称请和站点标识保持一致,不然无法正常 checkout

# SVN 安装命令
bash svn.sh

6、伪静态文件

# 增加一个 `wordpress` 伪静态文件
touch /etc/nginx/rewrite/wordpress.conf

# 修改 `mysite` 站点的配置
service vhost edit mysite mysite.com,www.mysite.com index.html,index.php,default.php wordpress.conf on

7、备份

service vbackup (start,list,del) <delete name.tar.gz>

参数说明

  • start 添加

  • list 列出

  • del 删除

  • <delete name.tar.gz> 需要删除的备份文件名称,和 del 搭配使用,存放在 /home/backup/

参数示例

# 添加一个新的备份
service vbackup start

# 列出备份文件
service vbackup list

# 删除一个备份
service vbackup del c7-20151010-101010.tar.gz

8、示例图

9、协议

The MIT License (MIT)

lnmp's People

Contributors

maicong avatar

Stargazers

icanfly520 avatar

Watchers

James Cloos avatar icanfly520 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.