V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
andybest
V2EX  ›  问与答

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

  •  
  •   andybest · 2013-04-12 11:29:18 +08:00 · 2511 次点击
    这是一个创建于 4037 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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复制了三遍。。。

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

    再次感谢 :)
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2498 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 14:46 · PVG 22:46 · LAX 07:46 · JFK 10:46
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.