zoukankan      html  css  js  c++  java
  • lnmp环境

    1、准备一台服务器

    192.168.52.35

    2、关闭防火墙

    systemctl stop firewalld

    setenforce 0

    3、上传nginx包并解压

    [root@localhost ~]# ls
    anaconda-ks.cfg  nginx-1.16.1  nginx-1.16.1.tar.gz  original-ks.cfg

    4、安装nginx依赖环境

    yum -y install gcc gcc-c++ pcre-devel  zlib-devel

    5、解压nginx,编译,安装

    cd /nginx-1.161      ./configure  && make &&  make install

    6、配置nginx文件

    vim /usr/local/nginx/conf/nginx.conf
    
    
        server {
            listen       80;
            server_name  localhost;
    
            #charset koi8-r;
    
            #access_log  logs/host.access.log  main;
    
            location / {
                root   html;
                index  index.php index.html index.htm;     #添加index.php
            }
    
    将这几行的注释去掉   CTRL+V  方向键下拉+D
           location ~ .php$ {
               root           html;
               fastcgi_pass   127.0.0.1:9000;
               fastcgi_index  index.php;
               fastcgi_param  SCRIPT_FILENAME          
                    $document_root$fastcgi_script_name;   #将这行改动$document_root
               include        fastcgi_params;
           }

    7、启动nginx

    /usr/local/nginx/sbin/nginx

    8、安装lnmp环境

    yum -y install mariadb mariadb--server php php-gd php-mysql php-fpm

    9、启动php-fpm

    systemctl start php-fpm

    10、编写PHP测试页面

    [root@localhost ~]# vim /usr/local/nginx/html/index.php
    [root@localhost ~]# cat /usr/local/nginx/html/index.php
    <?php
    phpinfo();
    ?>
    [root@localhost ~]# 

    11、重新挂载nginx

    /usr/local/nginx/sbin/nginx -s reload

    12、lnmp环境搭建完成

  • 相关阅读:
    JAVA反射机制--静态加载与动态加载
    MyEclipse导入Hibernate出现Path must include project and resource;/project name
    服务器和java程序的桥梁--jdbc/hibernate
    AndroidStudio快捷键大全
    AndroidStudio怎么实现微信分享功能
    《一面》
    java泛型
    java设计模式-Observer(2)
    java设计模式-Observe
    HashSet的自定义实现
  • 原文地址:https://www.cnblogs.com/Zrecret/p/12068326.html
Copyright © 2011-2022 走看看