Guest User

Untitled

a guest
Jan 18th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. #user nobody;
  2. worker_processes 2;
  3.  
  4. #error_log logs/error.log;
  5. #error_log logs/error.log notice;
  6. #error_log logs/error.log info;
  7.  
  8. #pid logs/nginx.pid;
  9.  
  10.  
  11. events {
  12. worker_connections 1024;
  13. }
  14.  
  15.  
  16. http {
  17. #passenger_root /home/ubuntu/.rvm/gems/ruby-2.2.2/gems/passenger-5.0.23;
  18. #passenger_ruby /home/ubuntu/.rvm/gems/ruby-2.2.2/wrappers/ruby;
  19.  
  20. include mime.types;
  21. default_type application/octet-stream;
  22.  
  23. #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  24. # '$status $body_bytes_sent "$http_referer" '
  25. # '"$http_user_agent" "$http_x_forwarded_for"';
  26.  
  27. #access_log logs/access.log main;
  28.  
  29. sendfile on;
  30. #tcp_nopush on;
  31.  
  32. #keepalive_timeout 0;
  33. keepalive_timeout 65;
  34.  
  35. gzip on;
  36.  
  37. upstream unicorn {
  38. server unix:/tmp/unicorn.mydomain.sock fail_timeout=0;
  39. }
  40.  
  41. server {
  42. listen 80;
  43. server_name www.mydomain.ru;
  44. rewrite ^(www.)?(.*)$ $scheme://$2$request_uri last;
  45. return 301 http://mydomain.ru$request_uri;
  46. }
  47.  
  48. server {
  49. listen 80;
  50. server_name mydomain.ru;
  51. #if ($host ~* ^(www.)?(.*)$) {
  52. if ($host ~* ^www.(.*)$) {
  53. #server_name mydomain.ru;
  54. return 301 $scheme://$1$request_uri;
  55. }
  56. root /home/ubuntu/123/current/public;
  57. #passenger_enabled on;
  58. client_max_body_size 30M;
  59.  
  60. #charset koi8-r;
  61.  
  62. #access_log logs/host.access.log main;
  63.  
  64. location ^~ /assets/ {
  65. gzip_static on;
  66. expires max;
  67. add_header Cache-Control public;
  68. }
  69.  
  70. try_files $uri/index.html $uri @unicorn;
  71. location @unicorn {
  72. proxy_set_header X-Forwared-For $proxy_add_x_forwarded_for;
  73. proxy_set_header Host $http_host;
  74. proxy_set_header X-Real-IP $remote_addr;
  75. proxy_set_header CLIENT_IP $remote_addr;
  76. proxy_redirect off;
  77. proxy_pass http://unicorn;
  78. }
  79. }
  80.  
  81. }
Add Comment
Please, Sign In to add comment