欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

一个 ok 的 nginx 的虚拟主机的配置 有大用 有大大用

server {

        listen       80;

        root /www/web/aaaa-ict_com/public_html;

        server_name jsfaq.aaaa-ict.com;

        index  index.html index.php index.htm;

        error_page  400 /errpage/400.html;

        error_page  403 /errpage/403.html;

        error_page  404 /errpage/404.html;

        error_page  503 /errpage/503.html;

        location ~ \.php$ {

                proxy_pass http://127.0.0.1:88;

                include naproxy.conf;

        }

        location  /pdf/ {        #只能防止 访问  /pdf/ 下的 html 实在不懂????

                return 404;

        }

        location ~*  /pdf/.*\.(gif|jpg|jpeg|png)$ {  #防止 访问  /pdf/ 下的 图像文件

                valid_referers  blocked *.luxshare-ict.com;

                if ($invalid_referer){

                    return 404;

                }

        }

        location  /doc/ {

                return 404;

        }

        location ~*  /doc/.*\.(gif|jpg|jpeg|png)$ {

                valid_referers  blocked *.luxshare-ict.com;

                if ($invalid_referer){

                    return 404;

                }

        }

        location ~*  /sites/default/files/private/.*\.(gif|jpg|jpeg|png)$ {

                valid_referers  blocked *.luxshare-ict.com;

                if ($invalid_referer){

                    return 404;

                }

        }

        location ~ system.*\.(gif|jpg|jpeg|png|bmp|swf)$ {

                proxy_pass http://127.0.0.1:88;

                include naproxy.conf;

        }

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {

                expires      1d;

        }

        location ~ .*\.(js|css|htm)?$ {

                expires      12h;

        }

        location ~ /\.ht {

                deny  all;

        }

        location / {

                try_files $uri @apache;

        }

        location @apache {

                 internal;

                 proxy_pass http://127.0.0.1:88;

                 include naproxy.conf;

        }

}


普通分类: