Chinaunix

标题: nginx 配置问题 [打印本页]

作者: asd0109    时间: 2014-09-26 10:04
标题: nginx 配置问题
我现在想用 windows 下的 nginx 来配置一个反向代理,目的是缓存我的本地局域网访问youku达到加速。 将youku缓存到本地,清除1天的缓存。

哪位朋友能帮忙给我写出配置啊? 我刚配置了

  server {
        listen       8080;
        server_name  localhost;
access_log logs/log.log main;
        charset utf-8;


location / {

                proxy_pass   http://www.iqiyi.com;

       }




然后就提示我      nginx: [emerg] "server" directive is not allowed here in E:\nginx-1.7.5/conf/nginx.conf:1




作者: chenyx    时间: 2014-09-26 10:29
看提示,是你配置放的位置不对吧,你是放到http{}里面了吗
作者: asd0109    时间: 2014-09-26 10:36
chenyx 发表于 2014-09-26 10:29
看提示,是你配置放的位置不对吧,你是放到http{}里面了吗



谢谢!


我改成这样可以了

events {
    worker_connections  1024;
}

http{

  server {
        listen       8080;
        server_name  localhost;

        charset utf-8;


location / {

                proxy_pass   http://www.iqiyi.com;

       }

}



}

作者: asd0109    时间: 2014-09-26 10:37
现在   我想知道如何把IQIYI的链接都变成我的本地网址

还有   如何将文件存放到 nginx 本地的磁盘 如何配置

谢谢
作者: chenyx    时间: 2014-09-26 13:30
这个没做过.
nginx有缓存的功能,不过不是很强大.你要做缓存服务,尝试squid或啊apache traffic server(ats)那个
作者: action08    时间: 2014-09-27 02:14
完整的配置文件,




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2