nginx.conf 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. user nginx;
  2. worker_processes auto;
  3. error_log /var/log/nginx/error.log notice;
  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. keepalive_timeout 65;
  17. server_tokens off;
  18. gzip on;
  19. gzip_min_length 1k;
  20. gzip_buffers 4 16k;
  21. gzip_http_version 1.0;
  22. gzip_comp_level 2;
  23. gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/rss+xml application/xhtml+xml application/atom_xml;
  24. gzip_vary on;
  25. server {
  26. listen 80;
  27. server_name localhost;
  28. root /usr/share/nginx/frontend;
  29. autoindex off;
  30. autoindex_exact_size off;
  31. autoindex_localtime on;
  32. location / {
  33. index index.html index.htm;
  34. gzip_static on;
  35. if ($request_filename ~* ^.*?\.(eot)|(ttf)|(woff)|(svg)|(otf)$) {
  36. add_header Access-Control-Allow-Origin *;
  37. }
  38. try_files $uri $uri/ =404;
  39. }
  40. error_page 500 502 503 504 /50x.html;
  41. location = /50x.html {
  42. root html;
  43. }
  44. }
  45. }