小编Dig*_*ite的帖子

如何在NGINX中重定向URL

我需要将每个http://test.com请求重定向到http://www.test.com.如何才能做到这一点.

在服务器块中我尝试添加

 rewrite ^/(.*) http://www.test.com/$1 permanent;
Run Code Online (Sandbox Code Playgroud)

但它在浏览器中说

  The page isn't redirecting properly

  Firefox has detected that the server is redirecting the request for 
  this address in a way that will never complete.
Run Code Online (Sandbox Code Playgroud)

我的服务器块看起来像

 server {
            listen       80;
            server_name  test.com;
            client_max_body_size   10M;
            client_body_buffer_size   128k;

            root       /home/test/test/public;
            passenger_enabled on;
            rails_env production;

            #rewrite ^/(.*) http://www.test.com/$1 permanent;
            #rewrite ^(.*)$ $scheme://www.test.com$1;

            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                    root   html;
            }
    }
Run Code Online (Sandbox Code Playgroud)

redirect nginx url-rewriting

134
推荐指数
4
解决办法
27万
查看次数

你如何更改nginx返回的服务器头?

有一个隐藏版本的选项,因此它只显示nginx,但有没有办法隐藏它,所以它不会显示任何内容或更改标题?

nginx http-headers

132
推荐指数
9
解决办法
15万
查看次数

jQuery滚动到不同页面的ID

我试图在一些页面内使用jQuery的页面滚动,并且可以成功地使页面滚动顺畅.我现在唯一的问题是尝试从不同的页面执行此操作.我的意思是,如果我点击页面中的链接,它应该加载新页面,然后滚动到特定的div元素.

这是我用于在页面内滚动的代码:

var jump=function(e)
{
       //prevent the "normal" behaviour which would be a "hard" jump
       e.preventDefault();
   //Get the target
   var target = $(this).attr("href");
   //perform animated scrolling
   $('html,body').animate(
   {
           //get top-position of target-element and set it as scroll target
           scrollTop: $(target).offset().top
   //scrolldelay: 2 seconds
   },2000,function()
   {
           //attach the hash (#jumptarget) to the pageurl
           location.hash = target;
   });

}

$(document).ready(function()
{
       $('a[href*=#]').bind("click", jump);
       return false;
});
Run Code Online (Sandbox Code Playgroud)

我希望这个想法很清楚.

谢谢

非常重要注意:我上面发布的这段代码在同一页面内工作得很好,但我所追求的是从一个页面单击一个链接然后转到另一个页面,然后滚动到目标.我希望现在很清楚.谢谢

jquery scroll smooth-scrolling

47
推荐指数
4
解决办法
10万
查看次数

未声明纯文本文档的字符编码 - mootool脚本

我刚刚注意到,当我在FireFox浏览器上查看我的mootool.js脚本时,会弹出一条警告消息.

警告消息是" 未声明纯文本文档的字符编码.如果文档包含来自US-ASCII范围之外的字符,则文档将在某些浏览器配置中使用乱码文本呈现.文件的字符编码需要是在传输协议或文件中声明需要使用字节顺序标记作为编码签名.

这是否意味着我必须添加Charset或其他什么?但它是一个脚本!!

这有解决方案吗?

firefox encoding

34
推荐指数
4
解决办法
8万
查看次数

nginx将HTTPS重定向到HTTP

如何从https重定向到http?

我有下面的代码,但它似乎不起作用.

server {
        listen 443;
        server_name example.com;
        rewrite ^(.*) http://example.com$1 permanent;
 }
Run Code Online (Sandbox Code Playgroud)

https nginx http-redirect

30
推荐指数
3
解决办法
6万
查看次数

没有`www`,域名不起作用

当我输入我的域名时没有www(喜欢http://example.com),它不起作用并给出错误信息.但是,当我添加www它(如http://www.example.com)时,它的工作原理.

是不是应该双向工作(有和没有www)?

subdomain dns .htaccess web

28
推荐指数
2
解决办法
8万
查看次数

将SSL连接到子域

我有一个SSL分配给我的主域名,我想知道我是否可以使用SSL到我的子域!我坦率地试了一下,但它显示警告页面说这个页面不安全等等.有没有解决方案,所以我可以在我的子域上使用SSL让客户端在安全连接上发送他们的信息.

错误消息 " This webpage is not available"

subdomain ssl

24
推荐指数
1
解决办法
3万
查看次数

页面从div跳转到锚点

我试图从做一个div跳转<a href="#FAQ">FAQ</a>到一个divID,可能容易成功,但因为我有一个固定的链接跳转到,我似乎无法找到一种方法如何做到这一点.

意思是,我想要一个div一个href链接跳转到同一页面中的url说<a href="http://www.mydomain.ask.html">Ask</a>

我肯定知道从一个锚点跳到<a href="#jump">jump</a>一个div这样的<div id="jump">jump to point</div>工作正常.但是,相反的方式呢?它有用吗?我的意思是从div id跳到锚点工作?

html anchor page-jump

12
推荐指数
1
解决办法
8万
查看次数

同时使用Opcache和Xcache

我只是想知道同时使用Xcache 3和Zend Opcache缓存PHP文件是愚蠢的吗?我知道两者几乎都做同样的工作,但不确定这是否会对性能和速度产生任何影响.

我想加快我的php页面加载速度,以便访问者不需要等待很长时间.

有什么想法吗?

php xcache opcache

8
推荐指数
1
解决办法
6227
查看次数

如何在一个端口和一个服务器块中设置具有不同域的nginx

我有

server {
    listen 80;
    server_name domain1 domain2 domain3

    location / {
        proxy_pass http://127.0.0.1:8088;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;

        proxy_connect_timeout   120;
        proxy_send_timeout      120;
        proxy_read_timeout      180;
    }
}

server {
     listen domainX:80;
     server_name domainX www.domainX

     location / {
            proxy_pass http://127.0.0.1:8088;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;

            proxy_connect_timeout   120;
            proxy_send_timeout      120;
            proxy_read_timeout      180;
    }

    location ~* \.(jpeg|jpg|gif|png|ico|bmp|swf|css|js)$ {
            root domainXStaticRoot
    }

    # other options for domainX only
}
Run Code Online (Sandbox Code Playgroud)

对于来自第一个服务器块的域,nginx仅返回根页面:

http://domain1 -> returns root page for …
Run Code Online (Sandbox Code Playgroud)

apache reverse-proxy nginx

5
推荐指数
0
解决办法
1205
查看次数