zoukankan      html  css  js  c++  java
  • nginx配置杂记

    1、一个接口的形式要求是:IP+端口,并且通信协议类型是:https,如何做域名解析:

    ①设置一个端口。同时在防火墙中打开这个端口,重启防火墙;


    ②在服务器上/etc/nginx/conf.d的目录下,增加一个nginx配置文件,相当于增加一个站点服务,只不过这个站点不用域名而是用IP地址加端口的方式;
      把这个文件配置文件上传到服务器,重启nginx。

    附:配置文件内容   demo.notify.ssl.conf

    server {
            listen       8001;
            server_name  120.xxx.xxx.xxx;
    
            ssl                  on;
            ssl_certificate      /data/ssl/www.xxx.pem;
            ssl_certificate_key   /data/ssl/www.xxx.key;
            ssl_session_timeout  5m;
            ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
            ssl_ciphers  ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
            ssl_prefer_server_ciphers   on;
    
            location / {
                root   /data/www/xxx;
                #index  index.html index.htm index.php;
                index  xxxxxx__notify.php;
            if (!-e $request_filename) {
                    #rewrite ^(.*)$ /index.php?s=$1 last;
                    rewrite ^/(.*)$ /index.php/$1 last;
                    break;
                }
            }
    
        location ~ .php {
            root           /data/www/xxx;
    
            fastcgi_pass 127.0.0.1:9000;
    
            fastcgi_index index.php;
    
            include fastcgi.conf;
    
            set $real_script_name $fastcgi_script_name;
    
            if ($fastcgi_script_name ~ "^(.+?.php)(/.+)$") {
    
                set $real_script_name $1;
    
                set $path_info $2;
    
            }
    
            fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
    
            fastcgi_param SCRIPT_NAME $real_script_name;
    
            fastcgi_param PATH_INFO $path_info;
    
            }
    }
  • 相关阅读:
    Airtest环境搭建及介绍
    再谈PHP错误与异常处理
    Composer基础
    PHP中this,self,parent的区别
    3种方法轻松处理php开发中emoji表情的问题
    php防注入和XSS攻击通用过滤.
    mysql where in 数组解决小tips
    记录搜索关键字到数据库
    获取用户id的方法
    file_get_contents('php://input') 数据如何转换成数组
  • 原文地址:https://www.cnblogs.com/wangyuman26/p/6178559.html
Copyright © 2011-2022 走看看