Nginx static file serving with jetty proxy


/ Published in: Bash
Save to your folder(s)

Nginx Jetty proxy basic configuration file, static content is served by Nginx.


Copy this code and paste it in your HTML
  1. http {
  2. include /etc/nginx/mime.types;
  3.  
  4. access_log /var/log/nginx/access.log;
  5.  
  6. sendfile on;
  7. #tcp_nopush on;
  8.  
  9. #keepalive_timeout 0;
  10. keepalive_timeout 3;
  11. tcp_nodelay on;
  12.  
  13. gzip on;
  14. gzip_comp_level 2;
  15. gzip_proxied any;
  16. gzip_types text/plain text/html text/css application/x-javascript text/xml
  17. application/xml application/xml+rss text/javascript;
  18. gzip_disable "MSIE [1-6]\.(?!.*SV1)";
  19.  
  20. include /etc/nginx/conf.d/*.conf;
  21. include /etc/nginx/sites-enabled/*;
  22. server {
  23. listen 80;
  24. server_name example.com;
  25. location ~* ^.+\.(jpg|jpeg|png|css|js)$
  26. {
  27. access_log off;
  28. expires 30d;
  29. root /var/www/narkisr.com;
  30. }
  31.  
  32. location / {
  33. access_log /var/log/nginx_67_log;
  34. proxy_pass http://127.0.0.1:8080/;
  35. proxy_redirect off;
  36. proxy_set_header Host $host;
  37. proxy_set_header X-Real-IP $remote_addr;
  38. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  39. }
  40. }
  41. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.