github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/conf/nginx.conf (about) 1 #user nobody; 2 worker_processes auto; 3 worker_cpu_affinity auto; 4 5 error_log logs/error.log; 6 #error_log logs/error.log notice; 7 #error_log logs/error.log info; 8 9 pid logs/nginx.pid; 10 11 events 12 { 13 use epoll; 14 worker_connections 51200; 15 } 16 17 # load modules compiled as Dynamic Shared Object (DSO) 18 # 19 #dso { 20 # load ngx_http_fastcgi_module.so; 21 # load ngx_http_rewrite_module.so; 22 #} 23 24 http { 25 include mime.types; 26 default_type application/octet-stream; 27 28 #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 29 # '$status $body_bytes_sent "$http_referer" ' 30 # '"$http_user_agent" "$http_x_forwarded_for"'; 31 32 #access_log logs/access.log main; 33 34 sendfile on; 35 #tcp_nopush on; 36 37 #keepalive_timeout 0; 38 keepalive_timeout 65; 39 40 gzip on; 41 gzip_min_length 1k; 42 gzip_comp_level 5; 43 gzip_buffers 4 16k; 44 gzip_http_version 1.1; 45 gzip_types text/plain application/x-javascript text/css application/xml; 46 gzip_proxied any; 47 48 fastcgi_connect_timeout 900; 49 fastcgi_send_timeout 900; 50 fastcgi_read_timeout 900; 51 52 server { 53 listen 80; 54 server_name .yougam.com; 55 if ($host != 'www.yougam.com' ) { 56 rewrite ^/(.*)$ http://www.yougam.com/$1 permanent; 57 } 58 index default.html index.html index.htm index.php index.jsp index.asp index.aspx; 59 root /mnt/gopath/src/yougam; 60 61 set $ip $http_x_forwarded_for; 62 63 if ($ip ~ ^$ ){ 64 set $ip $remote_addr; 65 } 66 proxy_set_header X-Forwarded-For "$ip, $server_addr"; 67 68 location ~ ^/(business|css|font|fonts|img|js|libs|music|root|video)/ { 69 if ($query_string){ 70 expires max; 71 } 72 root /mnt/gopath/src/yougam/public; 73 break; 74 } 75 76 location ~ ^/(captcha|user|search|accept|ignore|new|edit|delete|view|close|open|like|hate|core|root)/ { 77 proxy_pass http://localhost:8000; 78 break; 79 } 80 81 location / { 82 proxy_pass http://localhost:8000; 83 break; 84 } 85 } 86 87 #server end 88 89 # another virtual host using mix of IP-, name-, and port-based configuration 90 # 91 #server { 92 # listen 4000; 93 # listen somename:8080; 94 # server_name somename alias another.alias; 95 96 # location / { 97 # root html; 98 # index index.html index.htm; 99 # } 100 #} 101 102 103 # HTTPS server 104 # 105 #server { 106 # listen 443; 107 # server_name localhost; 108 109 # ssl on; 110 # ssl_certificate cert.pem; 111 # ssl_certificate_key cert.key; 112 113 # ssl_session_timeout 5m; 114 115 # ssl_protocols SSLv2 SSLv3 TLSv1; 116 # ssl_ciphers HIGH:!aNULL:!MD5; 117 # ssl_prefer_server_ciphers on; 118 119 # location / { 120 # root html; 121 # index index.html index.htm; 122 # } 123 #} 124 125 }