我总感觉我这个nginx的虚机配置写的傻了吧唧的,如何优化一下?

2013-04-12 11:29:18 +08:00
 andybest
server {
listen 80;
server_name xxxx.com;
root /data/www;
location / {
index index.html index.php;
}
location ~ \.php$ {
root /data/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
include fastcgi_params;
fastcgi_connect_timeout 600s;
fastcgi_send_timeout 600s;
fastcgi_read_timeout 600s;
}
}


如上,我这个/data/www复制了三遍。。。

和解?感谢!
2520 次点击
所在节点    问与答
4 条回复
Channing
2013-04-12 11:49:19 +08:00
第一个留着
第二个删了
第三个那行改成 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
andybest
2013-04-12 11:50:47 +08:00
@Channing 感谢!其他还有能优化的地方吗?
Channing
2013-04-12 12:00:48 +08:00
没了。不过如果没有特殊需求3个timeout设为10分钟意义不大,默认的60s足以,这三行可删掉。
andybest
2013-04-12 12:08:18 +08:00
@Channing 已部署,确实好用(没想到nginx的root值是可以在子域继承的)
另外,那个timeout是为了上传大文件,所以不得已才设置这么长(如果上传就是要几分钟的话,有没更好的解决办法?)

再次感谢 :)

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/65661

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX