首页 > 代码库 > nginx配置杂记

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;

        }
}

 

nginx配置杂记