server {
listen 80 default_server;
root "/Users/tanteng/website";
access_log /Applications/MAMP/logs/nginx_access.log;
error_log /Applications/MAMP/logs/nginx_error.log debug;
location / {
index index.html index.php;
}
上面 listen 改为其他端口就没问题,改成 80 访问就是 502 bad gateway ,看 nginx_error.log,如下 debug :
2016/02/06 20:21:08 [debug] 5685#0: *4 write new buf t:1 f:0 00000001020022C8, pos 00000001020022C8, size: 156 file: 0, size: 0
2016/02/06 20:21:08 [debug] 5685#0: *4 http write filter: l:0 f:0 s:156
2016/02/06 20:21:08 [debug] 5685#0: *4 http output filter "/MAMP/index.php?language=English"
2016/02/06 20:21:08 [debug] 5685#0: *4 http copy filter: "/MAMP/index.php?language=English"
2016/02/06 20:21:08 [debug] 5685#0: *4 http postpone filter "/MAMP/index.php?language=English" 0000000102002490
2016/02/06 20:21:08 [debug] 5685#0: *4 write old buf t:1 f:0 00000001020022C8, pos 00000001020022C8, size: 156 file: 0, size: 0
2016/02/06 20:21:08 [debug] 5685#0: *4 write new buf t:0 f:0 0000000000000000, pos 00000001001A74C8, size: 120 file: 0, size: 0
2016/02/06 20:21:08 [debug] 5685#0: *4 write new buf t:0 f:0 0000000000000000, pos 00000001001A63C0, size: 52 file: 0, size: 0
2016/02/06 20:21:08 [debug] 5685#0: *4 http write filter: l:1 f:0 s:328
2016/02/06 20:21:08 [debug] 5685#0: *4 http write filter limit 0
2016/02/06 20:21:08 [debug] 5685#0: *4 writev: 328 of 328
2016/02/06 20:21:08 [debug] 5685#0: *4 http write filter 0000000000000000
2016/02/06 20:21:08 [debug] 5685#0: *4 http copy filter: 0 "/MAMP/index.php?language=English"
2016/02/06 20:21:08 [debug] 5685#0: *4 http finalize request: 0, "/MAMP/index.php?language=English" a:1, c:3
2016/02/06 20:21:08 [debug] 5685#0: *4 http request count:3 blk:0
2016/02/06 20:21:08 [debug] 5685#0: *4 http finalize request: -4, "/MAMP/index.php?language=English" a:1, c:2
2016/02/06 20:21:08 [debug] 5685#0: *4 http request count:2 blk:0
2016/02/06 20:21:08 [debug] 5685#0: *4 http finalize request: -4, "/MAMP/index.php?language=English" a:1, c:1
2016/02/06 20:21:08 [debug] 5685#0: *4 set http keepalive handler
2016/02/06 20:21:08 [debug] 5685#0: *4 http close request
2016/02/06 20:21:08 [debug] 5685#0: *4 http log handler
2016/02/06 20:21:08 [debug] 5685#0: *4 free: 0000000102000800, unused: 2
2016/02/06 20:21:08 [debug] 5685#0: *4 free: 0000000102001800, unused: 603
2016/02/06 20:21:08 [debug] 5685#0: *4 free: 0000000102000400
2016/02/06 20:21:08 [debug] 5685#0: *4 hc free: 0000000000000000 0
2016/02/06 20:21:08 [debug] 5685#0: *4 hc busy: 0000000000000000 0
2016/02/06 20:21:08 [debug] 5685#0: *4 reusable connection: 1
2016/02/06 20:21:08 [debug] 5685#0: *4 event timer add: 24: 75000:1454761343364
2016/02/06 20:21:08 [debug] 5685#0: *4 post event 00000001008374E0
2016/02/06 20:21:08 [debug] 5685#0: *4 delete posted event 00000001008374E0
2016/02/06 20:21:08 [debug] 5685#0: *4 http empty handler
2016/02/06 20:22:23 [debug] 5685#0: *4 event timer del: 24: 1454761343364
2016/02/06 20:22:23 [debug] 5685#0: *4 http keepalive handler
2016/02/06 20:22:23 [debug] 5685#0: *4 close http connection: 24
2016/02/06 20:22:23 [debug] 5685#0: *4 reusable connection: 0
2016/02/06 20:22:23 [debug] 5685#0: *4 free: 0000000000000000
2016/02/06 20:22:23 [debug] 5685#0: *4 free: 0000000100700320, unused: 0
2016/02/06 20:22:23 [debug] 5685#0: *4 free: 0000000100700420, unused: 104
本机是 MAMP 集成环境,初次配置 nginx ,不太懂,请多指教!谢谢!
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.