zoukankan      html  css  js  c++  java
  • nginx 配置虚拟主机(支持php)

    配置步骤:

    1、在nginx安装目录下,找到nginx.conf所在文件夹,新建vhost文件夹

    2、在nginx.conf http{} 末端加入 include vhost/*.conf;

    3、进入第一步创建的文件中,新建所需的配置文件  kt.conf

    4、编辑 kt.conf 加入以下内容

    server {
        listen 80;
        server_name www.kt.hd;
        root C:/www/kt/;
        index index.php index.html index.htm;
    
    
        location / {
           try_files $uri $uri/ /index.php$is_args$args; #去除框架中index.php
        }
    
        location ~ .php$ {
            
        fastcgi_pass   127.0.0.1:9000;
        #fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        fastcgi_split_path_info ^(.+.php)(.*)$;
            fastcgi_split_path_info ^(.+.php)(/.+)$;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
    
    
    }

    5、重启nginx

  • 相关阅读:
    Python字符串
    ListCtrl控件
    leetcode1004
    leetcode1003
    leetcode1002
    leetcode153
    leetcode540
    leetcode435
    leetcode999
    leetcode997
  • 原文地址:https://www.cnblogs.com/aajonas/p/6236369.html
Copyright © 2011-2022 走看看