• centos7.6 LNMP新版本


    1、centos7 安装PHP7.2版本
        #查询是否安装过php
        yum list installed | grep php
        yum provides php
        
        #移除php
        yum remove php-common
        
        #下载源
        rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
        rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
        
        yum install php72w php72w-opcache php72w-xml php72w-gd php72w-devel php72w-mysql php72w-intl php72w-mbstring php72w-fpm php72w-cli php72w-mbstring php72w-pdo php-redis
        
        php -v
        #PHP 7.2.14    
        
        #设置时区
        vim /etc/php.ini
        date.timezone = "Asia/Shanghai"
        
        #设置php-fpm运行用户组
        vim /etc/php-fpm.d/www.conf
        user  = nginx
        group = nginx
        listen.owner = nobody      前面;去掉
        listen.group = nobody      前面;去掉
        listen.mode = 0660            前面;去掉
        
        #启动php-fpm
        systemctl start php-fpm.service
        systemctl status php-fpm.service
        systemctl stop php-fpm.service
        systemctl restart php-fpm.service
        #设置开机自启动
        systemctl enable php-fpm.service
        
        #安装mcrypt扩展
        #mcrypt扩展从php7.1.0开始废弃,自php7.2.0起会移到pecl
        #http://pecl.php.net/package/mcrypt
        yum install libmcrypt libmcrypt-devel mcrypt mhash
        wget  http://pecl.php.net/get/mcrypt-1.0.1.tgz
        tar -zxvf mcrypt-1.0.1.tgz
        cd mcrypt-1.0.1
        
        #whereis phpize
        /usr/bin/phpize
        #whereis php-config
        ./configure --with-php-config=/usr/bin/php-config && make && make install
        
        #vim php.ini
        extension=mcrypt.so
        
        #重启php-fpm
        systemctl restart php-fpm.service
        
    2、nginx安装nginx-1.15.9

      nginx.conf:
      
    location ~ ^.+.php{
          fastcgi_buffer_size 128k;
          fastcgi_buffers 32 32k;
          #fastcgi_pass  unix:/var/run/php-fpm/php-fpm.sock;
          fastcgi_pass  127.0.0.1:9000;
          fastcgi_index index.php;
          fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_param PATH_INFO $fastcgi_path_info;
          fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
          include       fastcgi_params;
      }
    
    
    

    ps aux | grep nginx #kill 45124(ps aux | grep nginx执行之后第一条是pid) #踢出nginx所有进程 pkill -9 nginx systemctl stop nginx.service #移除nginx yum remove nginx yum list installed | grep nginx yum remove **** #再次检查nginx文件夹 find / -name nginx* #找出nginx目录(删除目录) rm -rf ***** #以上处理之后证明nginx已经清理干净了 #安装库 yum install zlib-devel yum install openssl openssl-devel yum install gcc gcc-c++ wget yum install automake autoconf libtool libxml2-devel libxslt-devel perl-devel perl-ExtUtils-Embed pcre-devel #cd /home/tools wget -c https://nginx.org/download/nginx-1.15.9.tar.gz tar -zxvf nginx-1.15.9.tar.gz cd nginx-1.15.9 ./configure make && make install #nginx默认安装在/usr/local/nginx #查看nginx当前版本 nginx/1.15.9 /usr/local/nginx/sbin/nginx -v pkill -9 nginx /usr/local/nginx/sbin/nginx #添加nginx项目配置文件夹 mkdir -p /usr/local/nginx/conf/conf.d #添加nginx运行错误日志文件夹 mkdir -p /var/log/nginx #完善nginx配置 vim /usr/local/nginx/conf/nginx.conf #修改nginx用户组 user nginx; #设置工作进程数 方便的话可以直接设置成auto worker_processes auto; #lscpu 可以查看下cpu的数量 #worker_processes一般设置和CPU数量一样且配合worker_cpu_affinity一起配置 worker_processes 2; worker_cpu_affinity 01 10; #配置nginx错误日志 error_log /var/log/nginx/error.log; #设置nginx.pid nginx.pid存放的是nginx的master进程的进程号 pid /run/nginx.pid; #http 对象中修改 #log_format 前的#去掉 #添加 client_max_body_size 200m; #添加 include /usr/local/nginx/conf/conf.d/*.conf; #项目的http配置文件可以放到conf.d文件夹中了 #nginx的启动与重启 /usr/local/nginx/sbin/nginx -s quit #nginx停止 /usr/local/nginx/sbin/nginx -s reload #nginx reload /usr/local/nginx/sbin/nginx #nginx启动 #nginx设置开机自启动 #即在rc.local增加启动代码就可以了 vi /etc/rc.local #增加一行 /usr/local/nginx/sbin/nginx #设置执行权限 chmod 755 /etc/rc.local 3、redis安装 yum install redis #启动redis systemctl start redis.service systemctl status redis.service systemctl stop redis.service systemctl restart redis.service #设置开机自启动 systemctl enable redis.service 4、mysql5.7.20安装 wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm #安装mysql源 yum localinstall mysql57-community-release-el7-8.noarch.rpm #安装mysql server yum install mysql-community-server #启动mysqld systemctl start mysqld.service systemctl status mysqld.service systemctl enable mysqld.service #查看临时密码 grep 'A temporary password' /var/log/mysqld.log #登录设置root新密码 alter user 'root'@'localhost' identified by 'xxxx';
       #修改密码策略 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
      # set global validate_password_policy=LOW; 5、php_screw-1.5 扩展编译 #进入http://sourceforge.net/projects/php-screw/下载最新版本php_screw-1.5.tar.gz #cd /home/tools tar -zxvf php_screw-1.5.tar.gz cd php_screw-1.5 #更改加密策略 vim php_screw.h #修改 define PM9SCREW “ PHPSCREW ” vim my_screw.h #数组中数据随便修改,但最多保持在5位数 vim php_screw.c #CG(extended_info) = 1; 修改为 CG(compiler_options) |= ZEND_COMPILE_EXTENDED_INFO; /usr/bin/phpize ./configure --with-php-config=/usr/bin/php-config make && make install #编译会在/home/tools/php_screw-1.5/modules文件夹 #/usr/lib64/php/modules/文件夹生成php_screw.so文件 #php.ini添加extension=php_screw.so vim /etc/php.ini systemctl restart php-fpm.service #生成加密二进制文件screw cd /home/tools/php_screw-1.5/tools make #make生成二进制文件screw cp screw /usr/bin/screw #接下来就玩起来吧 6、openssh升级到7.9 #先安装telnet服务,以防卸载openssh后连接不到服务器 yum list telnet-server yum install telnet-server yum list xinetd yum install xinetd #启动telnet服务 systemctl enable xinetd systemctl enable telnet.socket systemctl start telnet.socket systemctl start xinetd #默认情况下系统是不允许root用户telnet远程登录的 #如果要使用root用户直接登录需设置/etc/securetty vim /etc/securetty #添加 pts/0 #添加 pts/1 systemctl restart xinetd #root登录时总是提示 login incorrect vim /etc/pam.d/login #auth ****** pam_securetty.so 注释这行 #设置好后,最好重启下服务器 reboot systemctl start telnet.socket systemctl start xinetd #wget 下载资源包 wget
    https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.9p1.tar.gz #安装依赖包 yum install openssl openssl-devel pam-devel gcc gcc-c++ zlib zlib-devel zlib-static #解压openssh-7.9p1.tar.gz tar -zxvf openssh-7.9p1.tar.gz cd openssh-7.9p1 #备份/etc/ssh mv /etc/ssh /opt/ssh.bak #安装openssh7.9 ./configure --sysconfdir=/etc/ssh #没有错误继续 make && make install #查看版本 /usr/local/sbin/sshd -v #编译安装完毕后,默认不允许root远程登录 vim /etc/ssh/sshd_config #PermitRootLogin prohibit-password 改成 PermitRootLogin yes #重启sshd systemctl restart sshd systemctl stop sshd systemctl start sshd systemctl enable sshd #可以关闭下sshd来体验下telnet,登录telnet后台启动下sshd

    yum安装nginx
    rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
    yum install -y nginx
    systemctl start nginx.service
    systemctl enable nginx.service

    配置信息:

    网站文件存放默认位置(Welcome to nginx 页面)

    /usr/share/nginx/html

    
    

    网站默认站点配置

    /etc/nginx/conf.d/default.conf

    
    

    自定义 nginx 站点配置文件存放目录

    /etc/nginx/conf.d/

    
    

    nginx 全局配置文件

    /etc/nginx/nginx.conf

     
  • 相关阅读:
    vue多个自定义组件动态显示
    vue弹出多个弹框,并可以拖动弹框
    localStorage和sessionStorage
    Sharepoint ListTemplateId
    SharePoint 上传文档太大 无法上传
    Stream Byte[] 转换
    C#转义字符 单引号 双引号 换行 回车 斜杠
    c#中如何获取本机用户名、MAC地址、IP地址、硬盘ID、CPU序列号、系统名称、物理内存
    SharePoint Content Type ID's
    Visual Studio Tip: Get Public Key Token for a Strong Named Assembly 添加强命名 获取强命名值
  • 原文地址:https://www.cnblogs.com/mmmzh/p/11051072.html
Copyright © 2020-2023  润新知