Nginx访问配置
配置HTTP协议(使用80默认端口,非HTTPS配置SSL)访问网站
包括RestAPI的配置和RestAPI文档的配置
例如:
SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。server { # 配置为HTTP协议 listen 80; server_name api.tag.test.chinahanguang.com; # ssl on; # root /data/chgg/tag-service-api/restapi/web; # index index.html index.htm index.nginx-debian.html index.php; # ssl_certificate /data/cert/1843018_api.user.test.chinahanguang.com.pe m; # ssl_certificate_key /data/cert/1843018_api.user.test.chinahanguang.com .key; # ssl_session_timeout 5m; # ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNUL L:!MD5:!ADH:!RC4; # ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # ssl_prefer_server_ciphers on; # 配置API的接口文档访问; # 直接匹配,相当于rootconfig+directconfig location /apidoc/ { root /data/chgg/tag-service-api/restapi/web; index index.html; autoindex on; } # 配置php项目入口脚本;如果文件后缀为php则需要转发交给fastcgi进行处理 location / { root /data/chgg/tag-service-api/restapi/web; access_log /var/log/userapitest.access.log main; error_log /var/log/userapitest.error.log debug; index index.php index.html index.htm; if (!-e $request_filename){ rewrite "^(.*)$" /index.php?r=$1 last; } } # 配置php文件后缀的处理使用fastcgi location ~ \.php$ { root /data/chgg/tag-service-api/restapi/web; fastcgi_pass 127.0.0.1:9000; access_log /var/log/userapitest.access.log main; error_log /var/log/userapitest.error.log debug; index index.php index.html index.htm; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; if (!-e $request_filename){ rewrite "^(.*)$" /index.php?r=$1 last; } } }
配置HTTPS协议(使用443默认端口,需配置SSL证书)访问网站
在配置HTTP的基础上从阿里云下载SSL证书,并安装在Linux服务器上

更多精彩