nginx.conf 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #user nobody;
  2. worker_processes 1;
  3. error_log logs/error.log;
  4. #error_log logs/error.log notice;
  5. #error_log logs/error.log info;
  6. pid logs/nginx.pid;
  7. events {
  8. worker_connections 1024;
  9. }
  10. http {
  11. include mime.types;
  12. default_type application/octet-stream;
  13. # escape=json
  14. log_format user_log_format escape=none $data;
  15. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  16. '$status $body_bytes_sent "$http_referer" '
  17. '"$http_user_agent" "$http_x_forwarded_for"';
  18. #access_log logs/access.log main;
  19. sendfile on;
  20. #tcp_nopush on;
  21. #keepalive_timeout 0;
  22. keepalive_timeout 65;
  23. #gzip on;
  24. #lua_package_path 'D:/server/zeroStudio/lualibs/?/?.lua;D:/server/zeroStudio/lualibs/?.lua;;';
  25. #lua_package_cpath 'D:/server/zeroStudio/bin/clibs/?.dll;;';
  26. server {
  27. listen 8089;
  28. # listen 443 ssl;
  29. # server_name localhost;
  30. # ssl_certificate cert/cert.pem;
  31. # ssl_certificate_key cert/cert.key;
  32. # ssl_session_cache shared:SSL:1m;
  33. # ssl_session_timeout 5m;
  34. # ssl_ciphers HIGH:!aNULL:!MD5;
  35. # ssl_prefer_server_ciphers on;
  36. default_type 'application/json';
  37. charset utf-8;
  38. #access_log logs/host.access.log main;
  39. add_header 'Access-Control-Allow-Methods' 'GET,POST';
  40. location / {
  41. default_type text/html;
  42. content_by_lua_block {
  43. ngx.say("<p>welcome to platomix.net!</p>")
  44. }
  45. #root html;
  46. #index index.html index.htm;
  47. }
  48. location /sdata{
  49. #add_header 'Access-Control-Allow-Origin' $http_origin;
  50. add_header 'Access-Control-Allow-Origin' *;
  51. add_header 'Access-Control-Allow-Credentials' 'true';
  52. if ($request_method = 'OPTIONS') {
  53. add_header 'Access-Control-Max-Age' 1728000;
  54. add_header 'Content-Type' 'text/plain; charset=utf-8';
  55. add_header 'Content-Length' 0;
  56. return 204;
  57. }
  58. set $data '';
  59. content_by_lua_file "/usr/local/openresty/nginx/conf/lua_zlib_body.lua";
  60. access_log logs/data.log user_log_format;
  61. }
  62. #error_page 404 /404.html;
  63. # redirect server error pages to the static page /50x.html
  64. #
  65. error_page 500 502 503 504 /50x.html;
  66. location = /50x.html {
  67. root html;
  68. }
  69. }
  70. }