nginx配置杂记

时间:2024-01-17 20:27:38

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

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

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

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

server {
listen ;
server_name .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. TLSv1.;
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=$ last;
rewrite ^/(.*)$ /index.php/$ last;
break;
}
} location ~ \.php {
root /data/www/xxx; fastcgi_pass 127.0.0.1:; fastcgi_index index.php; include fastcgi.conf; set $real_script_name $fastcgi_script_name; if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") { set $real_script_name $; set $path_info $; } fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param PATH_INFO $path_info; }
}