nginx.conf 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. user nginx;
  2. worker_processes auto;
  3. error_log /var/log/nginx/error.log warn;
  4. pid /var/run/nginx.pid;
  5. events {
  6. worker_connections 1024;
  7. }
  8. http {
  9. include /etc/nginx/mime.types;
  10. default_type application/octet-stream;
  11. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  12. '$status $body_bytes_sent "$http_referer" '
  13. '"$http_user_agent" "$http_x_forwarded_for"';
  14. access_log /var/log/nginx/access.log main;
  15. sendfile on;
  16. #tcp_nopush on;
  17. keepalive_timeout 65;
  18. server {
  19. listen 80;
  20. server_name kejian.filog.cn;
  21. root /usr/share/nginx/html;
  22. #charset koi8-r;
  23. access_log /var/log/nginx/host.access.log main;
  24. error_log /var/log/nginx/error.log error;
  25. location / {
  26. add_header Access-Control-Allow-Origin *;
  27. add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE, OPTIONS';
  28. add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
  29. if ($request_method = 'OPTIONS') {
  30. return 204;
  31. }
  32. index index.html index.htm;
  33. try_files $uri $uri/ @fallback;
  34. }
  35. location @fallback {
  36. rewrite ^.*$ /index.html break;
  37. }
  38. # proxy_pass
  39. #location /login {
  40. # proxy_pass http://192.168.52.130:6032;
  41. #}
  42. #error_page 404 /404.html;
  43. # redirect server error pages to the static page /50x.html
  44. #
  45. error_page 500 502 503 504 /50x.html;
  46. location = /50x.html {
  47. root /usr/share/nginx/html;
  48. }
  49. }
  50. #gzip on;
  51. include /etc/nginx/conf.d/*.conf;
  52. }