美文网首页
centos7.3(1611)安装nignx+php7.1+ma

centos7.3(1611)安装nignx+php7.1+ma

作者: laidian | 来源:发表于2016-08-18 16:54 被阅读429次

    virtualbox安装centos7.3-1611

    //win 上可以建立软链接
    VBoxManage setextradata CentOS7.2 VBoxInternal2/SharedFoldersEnableSymlinksCreate/laravel-php 1
    

    配置这个环境配烂了,本人版本帝
    webtatic这个源很好,主要更新快啊
    rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    ps: epel.repo 会先安装这个源
    rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
    注意弄完
    /etc/yum.repo.d/epel.repo中enable需要置为1
    install php7.1 php-fpm方式,php71w-common这个中已经集成很多扩展了

    yum install php71w-fpm php71w-opcache php71w-cli php71w-common php71w-devel php71w-mbstring php71w-mcrypt php71w-mysqlnd php71w-pdo php71w-pecl-redis php71w-gd php71w-pecl-memcached php71w-pecl-xdebug
    

    vim /etc/php.ini

    timezone=RPC
    可以修改两个size 为20M,两个都要改,自己  vim /size 搜索
    

    vim /etc/php-fpm.d/www.conf 不用tcp连接要用sock连接,速度更快配合nginx那边

    listen = /dev/shm/php-cgi.sock
    listen.mode = 0666
    

    关闭firewall:

    systemctl stop firewalld.service #停止firewall
    systemctl disable firewalld.service #禁止firewall开机启动
    

    centos7.3默认关闭了selinux,就不去禁了
    安装nginx mariadb‘
    配置官方yum源,官方有yum源,一定要用官方的

    vim /etc/yum.repo.d/nginx.repo
    [nginx]
    name=nginx repo
    baseurl=http://nginx.org/packages/centos/7/$basearch/
    gpgcheck=0
    enabled=1
    
    vim /etc/yum.repo.d/MariaDB.repo
    # MariaDB 10.2 CentOS repository list - created 2017-06-03 17:28 UTC
    # http://downloads.mariadb.org/mariadb/repositories/
    [mariadb]
    name = MariaDB
    baseurl = http://yum.mariadb.org/10.2/centos7-amd64
    gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
    gpgcheck=1
    
    yum install MariaDB-server MariaDB-client nginx redis
    配置mariadb
    mysql_secure_installation 
    

    redis官方是个压缩包,可以直接用yum安装,虽然不是最新的,但是官方压缩包解压使用,还需要写服务来开机启动,以后有时间写个

    nginx 站点配置,php使用sock连接

    在/etc/nginx/nginx.conf的http{}配置中加入
    sendfile        off;  否则共享文件无法实时更新js和css文件,这个我在stackflow上都没找到解决方案,偶然间发现,以前坑死我了
    
    server {
        listen 80;
        #listen 443 ssl;
        #server_name ;
        charset utf-8;
        set $root_path '/var/www/html/ss-panel/public';    
        root $root_path; 
        index  index.php index.html index.htm;
        location / {
            try_files $uri $uri/ /index.php?$query_string;
        }
        location = /favicon.ico { access_log off; log_not_found off; }
        location = /robots.txt  { access_log off; log_not_found off; }
        location ~ \.php {    
            fastcgi_pass   unix:/dev/shm/php-cgi.sock;   
            fastcgi_index  index.php;    
            fastcgi_split_path_info       ^(.+\.php)(/.+)$;    
            fastcgi_param PATH_INFO       $fastcgi_path_info;    
            fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;    
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;    
            include                       fastcgi_params;  
        }  
        location ~ /\.ht {
            deny all;
        }
        #ssl_certificate     /etc/nginx/ssl/gclove.com.crt;
        #ssl_certificate_key /etc/nginx/ssl/gclove.com.key;
    }
    

    java环境配置 jdk + hadoop + go,这个没啥难度

    JAVA_HOME=/usr/java/default
    JRE_HOME=/usr/java/default/jre
    PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
    CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
    export JAVA_HOME JRE_HOME CLASSPATH PATH
    
    
    HADOOP_HOME=/usr/local/hadoop
    HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
    PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
    export HADOOP_HOME HADOOP_COMMON_LIB_NATIVE_DIR PATH
    
    PATH=$PATH:/usr/pear/bin
    export PATH
    
    GOPATH=$HOME/work/go
    GOROOT=/usr/local/go
    GOBIN=$GOROOT/bin
    PATH=$PATH:$GOBIN
    export PATH GOROOT GOPATH
    

    相关文章

      网友评论

          本文标题:centos7.3(1611)安装nignx+php7.1+ma

          本文链接:https://www.haomeiwen.com/subject/jxivsttx.html