加入收藏 | 设为首页 | 会员中心 | 我要投稿 莱芜站长网 (https://www.0634zz.com/)- 云连接、建站、智能边缘云、设备管理、大数据!
当前位置: 首页 > 运营中心 > LNMP > 正文

centos7搭建LNMP环境编译安装 yum安装超详细

发布时间:2023-02-17 14:01:11 所属栏目:LNMP 来源:互联网
导读:文章目录 1. 首先了解编译安装和yum安装的区别。 2. yum安装准备工作---切换阿里云yum源 3. 编译安装lnmp **很不建议使用编译安装,麻烦且容易报错。** 4.yum安装lnmp **可以先执行一下 yum update** 5. lnmp一键安装 [参考网站](https://lnmp.org/) **不喜

  安装YUM管理工具
    yum install yum-utils
  安装PHP
   yum install PHP74-PHP-gd  PHP74-PHP-pdo PHP74-PHP-mbstring PHP74-PHP-cli PHP74-PHP-fpm PHP74-PHP-MysqLnd
  一些命令
  #启动fpm、停止fpm、重启、查看状态
  service PHP74-PHP-fpm start
  service PHP74-PHP-fpm stop
  service PHP74-PHP-fpm restart
  service PHP74-PHP-fpm status
  #设置开机自启动
  systemctl enable PHP74-PHP-fpm #取消自启动就用disable
  #查看开机启动项
  systemctl list-unit-files
  systemctl list-unit-files | grep enable
  最后附上Nginx配置文件,在/etc/Nginx/conf.d目录下
  server {
      listen       80 default_server;
      
      server_name  localhost;
      root         /usr/share/Nginx/html;
      # Load configuration files for the default server block.
      location / {
          # 这里改动了 定义首页索引文件的名称
          index index.PHP index.html index.htm;
      }
      error_page 404 /404.html;
          location = /40x.html {
      }
      error_page 500 502 503 504 /50x.html;
          location = /50x.html {
      }
      # 这里新加的
      # PHP 脚本请求全部转发到 FastCGI处理. 使用FastCGI协议默认配置.
      # FastCGI服务器和程序(PHP,Python)沟通的协议.
      location ~ .PHP$ {
          # 设置监听端口
          fastcgi_pass   127.0.0.1:9000;
          # 设置Nginx的默认首页文件(上面已经设置过了,可以删除)
          fastcgi_index  index.PHP;
          # 设置脚本文件请求的路径
          fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
          # 引入fastcgi的配置文件
          include        fastcgi_params;
      }
  }
  5. lnmp一键安装 参考网站 不喜欢这种方式,所以没测试过,可以看这篇文章
  Centos8(Liunx) 中安装PHP7.4 的三种方法和删除它的三种方法
 
  6. 一些报错
  Starting nginx (via systemctl):长时间没反应并提示信息Can‘t open PID file /var/run/nginx.pid (yet?) after start
  nginx 报异常"/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)处理方法

(编辑:莱芜站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

推荐文章
    热点阅读