在按照如何让Jetty将httpredirect到https的build议后,我们能够使我们的独立Jetty部署将所有HTTP请求redirect到HTTPS。 然而,redirect是一个302.我们怎样才能使这个301(永久)redirect呢? 作为参考,我们将其添加到Jetty的etc / webdefault.xml中: <web-app> … <security-constraint> <web-resource-collection> <web-resource-name>Everything in the webapp</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint> </web-app>
这是我的Nginxconfiguration: upstream app_server { # Bindings to the Gunicorn server server 127.0.0.1:8002 fail_timeout=0; } server { listen 80; server_name "~^www\.(.*)$"; return 301 https://$host$request_uri; } server { access_log path_to_nginx-access.log; error_log path_to_nginx-error.log; listen 443 ssl; server_name _; ssl_certificate path_to_nginx.crt; ssl_certificate_key path_to_nginx.key; client_max_body_size 4G; keepalive_timeout 5; root path_to_root; location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header […]
我需要在nginx上redirect特定的path,但无法find方法:)特别是redirect301这个url http://www.domain.com/c/Integratori-di-Proteine/Universal-.html http://www.domain.com/c/Integratori-Aminoacidi/+Watt.html 分别 http://www.domain.com/c/Integratori-di-Proteine/ http://www.domain.com/c/Integratori-Aminoacidi/ 我试过这个没成功 location ~ ^/c/(.+)/(.+)\.html { rewrite ^ http://www.domain.com/$1/; } 谢谢
现在的情况: 我成功地设法在我的Serverpilot(nginx / apache)服务器上手动设置SSL证书。 因为我的网站在Serverpilot服务器上运行,所以部分是nginx,部分是Apache。 我可以在我的服务器上执行Apache中的所有redirect,但我更喜欢在我的nginxconfiguration文件中以正确的方式执行,因为我已经读过这种方法。 由于nginx由serverpilotpipe理,所以我必须在位于我的服务器上的这个文件夹中的一个单独的nginxconfiguration文件中进行更改:/etc/nginx-sp/vhosts.d。 如您所见,Serverpilot不使用标准nginxconfiguration,Serverpilot安装来自Serverpilotconfiguration文件。 这个/etc/nginx-sp/vhosts.d文件夹中有两个文件: example.conf(这是Serverpilot的标准configuration文件,我没有改变它) example.ssl.conf(这是我用ssl规则创build的文件) 据我所知,Nginx首先读取第一个.conf文件,然后读取第二个.conf文件。 那是对的吗? 什么 example.conf(Serverpilot标准configuration文件)包含以下内容: server { listen 80; listen [::]:80; server_name server-example example.net www.example.net ; root /srv/users/serverpilot/apps/example/public; access_log /srv/users/serverpilot/log/example/example_nginx.access.log main; error_log /srv/users/serverpilot/log/example/example_nginx.error.log; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; include /etc/nginx-sp/vhosts.d/example.d/*.nonssl_conf; include /etc/nginx-sp/vhosts.d/example.d/*.conf; } 我创build了一个包含以下内容的example.ssl.conf: server { listen 443 ssl http2; listen […]
在早些时候问了一个冗长而复杂的问题之后,我现在使用了RedirectPermanent一些代码,我需要帮助。 我们正在合并一个旧的网站到新的一个,并不关心映射所有的古代url到新址的任何地方,所以它应该永久redirect到一个特殊的index.php将决定是否/在哪里redirect与PHP。 例外是一个子域,它应该做同样的事情,但不同的index.php。 这是我试图完成的“伪configuration” – 轻微的变化将工作,但我不能让它忽略请求的完整path,并无条件地去我的select与查询string的index.php。 #Subdomain from old site: #Process querystring from root\oldsite\subdomain\index.php <VirtualHost *:80> ServerName subdomain.oldsite.com RedirectPermanent / http://www.newsite.com/oldsite/subdomain/index.php </VirtualHost> #ALL other requests of any kind regardless of path #Process querystring from root\oldsite\index.php # Must show www.newsite.com, NOT www.oldsite.com <VirtualHost *:80> ServerName oldsite.com ServerAlias www.oldsite.com RedirectPermanent / http://www.newsite.com/oldsite/index.php </VirtualHost> 已经设置了DNS,以便从旧站点的所有内容都进入该服务器,这些是configuration文件中的第一个VirtualHost条目。 我如何修改这个代码去给定的index.php, 不pipepath。 www.oldsite.com […]
我使用HTTPS协议(nginx webserver)运行一个网站。 现在我想将其迁移到一个新的域名。 我在使用HTTP的时候多次做了这个。 但是,使用HTTPS将会有所不同,因为应该为新的域名提供不同的证书。 提前了解并避免什么隐患? 什么是尽可能平稳过渡移民的最佳途径?
我如何301使用IIS将domain1.com的所有stream量引导到domain2.com? 另外我需要domain1.com/page.aspx?params直接到domain2.com/page.aspx?params。
我想要dev.test.com,去特定的目录/var/www/cakephp/dev/webroot 。 这是我的apache2 conf文件: <VirtualHost *:80> ServerName dev.test.com Redirect permanent / /var/www/cakephp/dev/webroot </VirtualHost> 我一直在获得连续的301 Moved permanently响应(直到服务器停止发送它们,或者是浏览器停止请求它们?) GET dev.test.com: http://dev.test.com/var/www/cakephp/dev/webroot GET webroot: http://dev.test.com/var/www/cakephp/dev/webrootvar/www/cakephp/dev/webroot GET webroot: http://dev.test.com/var/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webroot […] 21 requests later (seriously): GET webroot: http://dev.test.com/var/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webrootvar/www/cakephp/dev/webroot/var/www/cakephp/dev/webroot/var/www/cakephp/dev/webroot/var/www/cakephp/dev/webroot/var/www/cakephp/dev/webroot/var/www/cakephp/dev/webroot/var/www/cakephp/dev/webroot/var/www/cakephp/dev/webroot/var/www/cakephp/dev/webroot/var/www/cakephp/dev/webroot/var/www/cakephp/dev/webroot/var/www/cakephp/dev/webroot/var/www/cakephp/dev/webroot/var/www/cakephp/dev/webroot/var/www/cakephp/dev/webroot/var/www/cakephp/dev/webroot/var/www/cakephp/dev/webroot/var/www/cakephp/dev/webroot/var/www/cakephp/dev/webroot/var/www/cakephp/dev/webroot/ 我通过萤火虫发现了这些反应。 任何人都知道问题可能是什么? 谢谢。
我有我的主域url映射到我的服务器的根 我在/ blogs / techblog下安装了wordpress安装 我想引导任何stream量进入jameselsey.co.uk > jameselsey.co.uk/blogs/techblog 如果我把URL本身指向子目录,那么我的安装将不起作用 是否有可能做到这一点与我的服务器的根.htaccess文件? 我尝试了以下,但它创造了一个“无尽的循环” Redirect 301 / http://www.jameselsey.co.uk/blogs/techblog/
这组redirect不是静态的。 我们将每天增加和删除redirect十几次。 我们恰好使用了内置了redirectfunction的CMS(DotNetNuke),但每次添加或删除redirect时都必须重新构build各种caching,这在添加或删除redirect时会导致一些痛苦的性能问题。 我已经看过IISredirect。 但是,这些redirect存储在网站的web.config中。 在实时站点操作期间每天修改web.config十次以上redirect感觉不对。 在单个web.config中有这么多的redirect也是错误的。 我怀疑可能有IISredirect的替代存储方法,或者有另一种方法,我不知道。 对于那些有兴趣也许让我相信我们不需要那么多redirect的人,我希望你是对的。 这里有一些细节: 我们有30,000个旧的产品页面,每个页面都有自己的URL。 我们有30,000个新产品url。 我们有一个带查询string参数的新产品页面。 Products.aspx?PRODID = 123456 redirect过程将如下所示: OldProductURL1.PHP –301–> Products.aspx?ProdID=1 –200–> NewProductURL1.aspx 要么 OldPRoductURL1.PHP –301–> NewProductURL1.aspx (只要服务器运行Products.aspx?ProdID = 1来提供此页面) 有没有一个很好的方法来实现这一点,这将允许我们添加和删除redirect而不影响现场的性能显着?