zoukankan      html  css  js  c++  java
  • linux服务器使用yum安装nginx

    一,安装nginx和php-fpm

      yum install nginx php-fpm

    二, 找到nginx.conf

      find / -name nginx.conf

    三,添加解析php配置

       在server{}中添加如下来解析php

      location ~ .php$ {
                #root           html;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include        fastcgi_params;
            }

    四,nginx / php-fpm启动/停止

      nginx -s stop #停止nginx

      nginx -c  /etc/nginx/nginx.conf #启动nginx

      systemctl restart php-fpm.service #重启php-fpm

      查看开机自启列表

      systemctl list-unit-files|grep enabled

      systemctl enable nginx.service #开机自启nginx

      systemctl enable php-fpm.service #开机自启php-fpm

    五.配置多域名( * 如果不配置的话就略过此步骤)

      1,nginx.conf底部添加引用多个域名配置

         include /etc/nginx/vhost/*

      2.将server{}中间的内容复制并注释掉,在vhost目录中新建一个www.****.com.conf文件, 同时将复制的内容粘贴到该.conf文件中

      3.同理,若要配置二级域名或者多域名,就将2生成的文件复制一份并重命名

        4.nginx重启即可

       

  • 相关阅读:
    Qt判断文件夹是否存在并新建文件夹
    QFileDialog的使用
    C++11 std::chrono库详解
    disconnected no supported authentication methods available(server sent: publickey)
    connect函数的第5参数Qt::ConnectionType
    在C++ 中检查一个文件是否存在的几种方法
    win10打开便签
    1024. Palindromic Number (25)
    1023. Have Fun with Numbers (20)
    1021. Deepest Root (25)
  • 原文地址:https://www.cnblogs.com/gz-fenglang/p/7884828.html
Copyright © 2011-2022 走看看