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环境搭建完成

  • 相关阅读:
    arc路径例子-磊哥
    使用路径arc-奥运五环
    arc路径-磊哥
    使用路径arc-七彩
    html5- 摘自网友dudu
    使用路径arc
    textBaseline
    html5-磊哥
    【洛谷1345】 [USACO5.4]奶牛的电信(最小割)
    【洛谷1231】 教辅的组成(网络流)
  • 原文地址:https://www.cnblogs.com/Zrecret/p/12068326.html
Copyright © 2011-2022 走看看