V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
andybest
V2EX  ›  问与答

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

  •  
  •   andybest · Apr 12, 2013 · 3129 views
    This topic created in 4775 days ago, the information mentioned may be changed or developed.
    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 replies    1970-01-01 08:00:00 +08:00
    Channing
        1
    Channing  
       Apr 12, 2013   ❤️ 1
    第一个留着
    第二个删了
    第三个那行改成 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    andybest
        2
    andybest  
    OP
       Apr 12, 2013
    @Channing 感谢!其他还有能优化的地方吗?
    Channing
        3
    Channing  
       Apr 12, 2013   ❤️ 1
    没了。不过如果没有特殊需求3个timeout设为10分钟意义不大,默认的60s足以,这三行可删掉。
    andybest
        4
    andybest  
    OP
       Apr 12, 2013
    @Channing 已部署,确实好用(没想到nginx的root值是可以在子域继承的)
    另外,那个timeout是为了上传大文件,所以不得已才设置这么长(如果上传就是要几分钟的话,有没更好的解决办法?)

    再次感谢 :)
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5888 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 06:14 · PVG 14:14 · LAX 23:14 · JFK 02:14
    ♥ Do have faith in what you're doing.