Code Monkey home page Code Monkey logo

server-conf's Introduction

  1. 初始化系统

    yum -y update
    yum -y install yum-utils mysql vim wget zip unzip gcc autoconf  git \
    openssl-devel curl-devel \
    libxml2-devel libpng-devel freetype-devel libjpeg-devel ImageMagick-devel
    
  2. 安装 nginx

    a. 添加以下 repo 内容

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

    到 /etc/yum.repos.d/nginx.repo,执行 yum -y install nginx

    b. 禁用 selinux

    setenfore permissive
    sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config
    

    c. 临时关闭防火墙

    systemctl stop firewalld
    

    d. 启动 nginx

    systemctl enable nginx
    systemctl start nginx
    

    e. 测试

    curl -I localhost 看到类似输出

    HTTP/1.1 200 OK
    Server: nginx/1.14.0
    Date: Mon, 15 Oct 2018 09:51:06 GMT
    Content-Type: text/html
    Content-Length: 612
    Last-Modified: Tue, 17 Apr 2018 15:48:00 GMT
    Connection: keep-alive
    ETag: "5ad61730-264"
    Accept-Ranges: bytes
    

    nginx 安装完毕

  3. 安装 php

    a. 编译配置

    ./configure --prefix=/usr/local/php-7.2.11 \
    --with-config-file-path=/usr/local/php/etc \
    --enable-fpm \
    --enable-opcache \
    --enable-mysqlnd \
    --enable-bcmath \
    --enable-mbregex \
    --enable-mbstring \
    --enable-zip \
    --enable-inline-optimization \
    --enable-pcntl \
    --enable-xml \
    --with-mhash \
    --with-pdo-mysql=mysqlnd \
    --with-iconv-dir \
    --with-curl \
    --with-openssl \
    --with-zlib \
    --with-pear \
    --with-gd \
    --with-jpeg-dir \
    --with-png-dir \
    --with-freetype-dir \
    --with-gettext \
    --disable-cgi 
    

    b. 编译安装

    make && make install
    

    c. 杂项处理

    ln -sf /usr/local/php-7.2.11/ /usr/local/php
    ln -sf /usr/local/php/bin/* /usr/bin
    ln -sf /usr/local/php/sbin/php-fpm  /usr/sbin
    cp /usr/local/src/php-7.2.11/php.ini-production /usr/local/php/etc/php.ini
    cp /usr/local/src/php-7.2.11/sapi/fpm/php-fpm.service /usr/lib/systemd/system/php-fpm.service
    cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
    cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
    systemctl daemon-reload
    systemctl enable php-fpm
    systemctl start php-fpm
    pecl install igbinary redis
    pecl install imagick
    echo -e "extension=igbinary.so\nextension=redis.so\nextension=imagick.so" >> /usr/local/php/etc/php.ini
    
  4. 安装 redis

    yum -y install epel-release
    yum -y install redis
    systemctl enable redis
    systemctl start redis
    
  5. 安装 mysql

    wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
    rpm -Uvh ./mysql80-community-release-el7-1.noarch.rpm
    yum-config-manager --disable mysql80-community
    yum-config-manager --enable mysql57-community
    yum install mysql-community-server
    systemctl enable mysqld
    systemctl start mysqld
    

    参考:mysql docs

  6. 防火墙

    firewall-cmd --permanent --zone=public --add-port=22222/tcp
    firewall-cmd --permanent --zone=public --add-port=80/tcp
    firewall-cmd --permanent --zone=public --add-port=443/tcp
    firewall-cmd --permanent --zone=public --add-port=3306/tcp
    firewall-cmd --reload #重载
    firewall-cmd --zone=public --list-ports #查看
    
    firewall-cmd --zone=public --remove-port=80/tcp --permanent #删除
    

server-conf's People

Watchers

James Cloos 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.