{"action":"created","issue":{"url":"https://api.github.com/repos/gogits/gogs/issues/1558","labels_url":"https://api.github.com/repos/gogits/gogs/issues/1558/labels{/name}","comments_url":"https://api.github.com/repos/gogits/gogs/issues/1558/comments","events_url":"https://api.github.com/repos/gogits/gogs/issues/1558/events","html_url":"https://github.com/gogits/gogs/issues/1558","id":104427692,"number":1558,"title":"求一个Nginx反向代理的可用配置","user":{"login":"niphor","id":927255,"avatar_url":"https://avatars.githubusercontent.com/u/927255?v=3","gravatar_id":"","url":"https://api.github.com/users/niphor","html_url":"https://github.com/niphor","followers_url":"https://api.github.com/users/niphor/followers","following_url":"https://api.github.com/users/niphor/following{/other_user}","gists_url":"https://api.github.com/users/niphor/gists{/gist_id}","starred_url":"https://api.github.com/users/niphor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niphor/subscriptions","organizations_url":"https://api.github.com/users/niphor/orgs","repos_url":"https://api.github.com/users/niphor/repos","events_url":"https://api.github.com/users/niphor/events{/privacy}","received_events_url":"https://api.github.com/users/niphor/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/gogits/gogs/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/gogits/gogs/labels/feedback%20needed","name":"feedback needed","color":"fbca04"},{"url":"https://api.github.com/repos/gogits/gogs/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/gogits/gogs/milestones/9","html_url":"https://github.com/gogits/gogs/milestones/0.7.0","labels_url":"https://api.github.com/repos/gogits/gogs/milestones/9/labels","id":1226114,"number":9,"title":"0.7.0","description":"","creator":{"login":"Unknwon","id":2946214,"avatar_url":"https://avatars.githubusercontent.com/u/2946214?v=3","gravatar_id":"","url":"https://api.github.com/users/Unknwon","html_url":"https://github.com/Unknwon","followers_url":"https://api.github.com/users/Unknwon/followers","following_url":"https://api.github.com/users/Unknwon/following{/other_user}","gists_url":"https://api.github.com/users/Unknwon/gists{/gist_id}","starred_url":"https://api.github.com/users/Unknwon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unknwon/subscriptions","organizations_url":"https://api.github.com/users/Unknwon/orgs","repos_url":"https://api.github.com/users/Unknwon/repos","events_url":"https://api.github.com/users/Unknwon/events{/privacy}","received_events_url":"https://api.github.com/users/Unknwon/received_events","type":"User","site_admin":false},"open_issues":62,"closed_issues":2,"state":"open","created_at":"2015-07-26T11:28:23Z","updated_at":"2015-09-04T18:25:36Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2015-09-02T08:36:48Z","updated_at":"2015-09-04T19:02:29Z","closed_at":null,"body":"因为放在开发板上面，暴露在外网，我需要用Nginx反代Gogs，\r\n但是因为开发板性能不太强，Nginx经常超时。\r\n\r\n我用的master分支的代码，gogs 0.6.7.0829 Beta\r\n\r\n我现在的配置是\r\n```\r\nserver {\r\n\tlisten      443 ssl spdy;\r\n\tinclude /etc/nginx/ssl.conf;\r\n\tserver_name _;\r\n\r\n\tproxy_set_header   Host              $http_host;\r\n    \tproxy_set_header   X-Real-IP         $remote_addr;\r\n        \r\n    \tproxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;\r\n    \tproxy_set_header   X-Frame-Options   SAMEORIGIN;\r\n\r\n\tproxy_redirect\toff;\r\n\r\n\tkeepalive_timeout 60;\r\n\tsendfile on;\r\n\tsend_timeout 600s;\r\n\r\n        location /git/ {\r\n\t\tclient_body_buffer_size 32K;\r\n\t\tclient_max_body_size 300M;\r\n\r\n\t\tproxy_send_timeout\t86400s;\r\n\t\tproxy_read_timeout\t        86400s;\r\n    \t\tproxy_connect_timeout\t86400s;\r\n\t\tproxy_pass\thttp://gogs/;\r\n\t}\r\n\r\n}\r\n```\r\n\r\n可用看见 超时时间得设置非常长\r\n而 client_max_body_size 的话，和postBuffer 的设置有关;\r\n\r\n另外\r\n\r\n我想镜像github上的源时超时了\r\n```\r\n2015/09/01 16:51:55 \u001B[1;31m[...routers/repo/repo.go:91 handleCreateError()] [E] MigratePost: git clone --mirror: Process execution timeout\u001B[0m\r\n[Macaron] Completed /repo/migrate 500 Internal Server Error in 43m43.314713378s\r\n```\r\n\r\n而在我自己提交代码的时候有一堆的 401 不知道正不正常\r\n```\r\n[Macaron] Started GET /goagent/goagent.git/info/refs?service=git-upload-pack for 58.210.145.74\r\n[Macaron] Completed /goagent/goagent.git/info/refs?service=git-upload-pack 401 Unauthorized in 77.58497ms\r\n[Macaron] Started GET /goagent/goagent.git/info/refs?service=git-upload-pack for 58.210.145.74\r\n[Macaron] Completed /goagent/goagent.git/info/refs?service=git-upload-pack 401 Unauthorized in 21.30125ms\r\n[Macaron] Started GET /goagent/goagent.git/info/refs?service=git-upload-pack for 58.210.145.74\r\n[Macaron] Completed /goagent/goagent.git/info/refs?service=git-upload-pack 200 OK in 1.982112301s\r\n```\r\n\r\n还有\r\n\r\n不知道是不是放在二级目录下面的原因，自己镜像自己的源时，似乎没法获取Username\r\n```\r\n[Macaron] Started POST /repo/migrate for 192.168.8.1\r\n2015/09/01 17:00:11 \u001B[1;36m[T] action.NewRepoAction: goagent/dd\u001B[0m\r\n[Macaron] Started GET /niphor/memo.git/info/refs?service=git-upload-pack for 192.168.8.1\r\n[Macaron] Completed /niphor/memo.git/info/refs?service=git-upload-pack 401 Unauthorized in 21.199794ms\r\n2015/09/01 17:00:24 \u001B[1;31m[...routers/repo/repo.go:91 handleCreateError()] [E] MigratePost: git clone --mirror: Cloning into bare repository '/opt/gogs/data/gogs-repositories/goagent/dd.git'...\r\nfatal: could not read Username for 'https://dev.4do.in': No such device or address\r\n\u001B[0m\r\n[Macaron] Completed /repo/migrate 500 Internal Server Error in 13.304859111s\r\n```\r\n\r\n\r\n最后：\r\n\r\nhttps://github.com/gogits/gogs/blob/master/models/user.go#L183\r\n\r\ngravatar 默认链接开头是`//`所以，这么写所有gravatar 的头像都显示不出来了"},"comment":{"url":"https://api.github.com/repos/gogits/gogs/issues/comments/137823192","html_url":"https://github.com/gogits/gogs/issues/1558#issuecomment-137823192","issue_url":"https://api.github.com/repos/gogits/gogs/issues/1558","id":137823192,"user":{"login":"Unknwon","id":2946214,"avatar_url":"https://avatars.githubusercontent.com/u/2946214?v=3","gravatar_id":"","url":"https://api.github.com/users/Unknwon","html_url":"https://github.com/Unknwon","followers_url":"https://api.github.com/users/Unknwon/followers","following_url":"https://api.github.com/users/Unknwon/following{/other_user}","gists_url":"https://api.github.com/users/Unknwon/gists{/gist_id}","starred_url":"https://api.github.com/users/Unknwon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unknwon/subscriptions","organizations_url":"https://api.github.com/users/Unknwon/orgs","repos_url":"https://api.github.com/users/Unknwon/repos","events_url":"https://api.github.com/users/Unknwon/events{/privacy}","received_events_url":"https://api.github.com/users/Unknwon/received_events","type":"User","site_admin":false},"created_at":"2015-09-04T19:02:29Z","updated_at":"2015-09-04T19:02:29Z","body":"> fatal: could not read Username for 'https://dev.mydomain.xxx': No such device or address\r\n\r\nThis is the error I think, and Gogs can't help with it really."}}