我需要301redirect请求到http://server.com所有请求被redirect到http://newserver.com除非请求是针对我们在传统服务器上维护的任意目录列表(例如服务器.com / foo或server.com/bar) 我正在努力研究如何设置这个和正则expression式。 EG,我需要: http://server.com/page1redirect到http://newserver.com/page1 http://server.com/dir1/page2redirect到http://newserver.com/dir1/page2 http://server.com/foo加载正常 http://server.com/bar/baz.html加载正常 …因为'foo'和'bar'在我的传统dirs列表中。 我想知道是否要做到这一点是如何捕捉我的列表中的匹配,然后redirect其他任何通配符到新的服务器 – 但我不能让它的工作。 任何人都可以帮助我一些正则expression式,并为那些请重写? 谢谢
我尝试使用Nginx自带的基本HTTP身份validation来确保几个位置的安全,但由于某些原因,它不起作用。 我有: website.com/admin(用户ADMIN可访问)website.com/admin/secret.php(只能由用户SECRET访问) 我曾经在Lighttpd中工作过: "/admin/secret.php" => ( "method" => "basic", "realm" => "Server Administrator", "require" => "user=SECRET" ), "/admin" => ( "method" => "basic", "realm" => "Administrators", "require" => "user=ADMIN" ) 任何想法如何可以转换为Nginx。 我已经尝试了以下,但只有ADMIN会要求input密码: location /admin/secret.php { auth_basic "Restricted"; auth_basic_user_file /home/passwords/SECRET; try_files $uri = 404; fastcgi_pass localhost:9000; } location ^~ /admin/.+\.php$ { auth_basic "Restricted"; auth_basic_user_file /home/passwords/ADMIN; […]
我有以下几点: RewriteRule ([a-zA-Z0-9]{5})?/load_page/([0-9]+) 正则expression式的哪个configuration是最优的: RewriteRule ^/([a-zA-Z0-9]{5})?/load_page/([0-9]+) 要么 RewriteRule ^/load_page/([a-zA-Z0-9]{5})?/([0-9]+) 要么 RewriteRule ^/([a-zA-Z0-9]{5})?/([0-9]+)/load_page 谢谢
任何人都可以帮助我实现从http://subdomain.example.com/到http://example.com/所有URL的redirect,除了以“files /”开头的所有URL吗? 谢谢
我正在尝试redirect以下url Http://example.com/category/something redirect到 Http://something.example.com/category/something “什么”可以是任何东西。 我已经为通配符设置了nginx和Dns,并确认了这一点。
我试图写一个fail2ban正则expression式来捕获任何尝试用户id“administrador”的人。 例如,这个日志条目: Jan 2 09:55:01 mail2 dovecot: pop3-login: Disconnected: user=<administrador>, method=PLAIN, rip=::ffff:201.130.1.218 这是我到目前为止的正则expression式: failregex = (?: pop3-login|imap-login): .*(?:Disconnected: user=\<administrador\>).*rip=(?P<host>\S*),.* 它不捕获上面的日志条目,因为语法是错误的。 谁能帮忙?
在nagiosconfiguration define service{ use generic-service host_name xxx.xxx.com service_description xxx Status check_command check_http!xxx.xxx.com -S } 我想删除整个部分,如上面给出的正则expression式匹配xxx.xxx.com 。 如何使用sed或任何其他Linux实用程序
我已经build立了像这样的configuration: $HTTP["host"] =~ "(^|\.)domain1\.com$" { fastcgi.server = ( "/domain1.py" => (( "socket" => "/tmp/fastcgi.socket", "bin-path" => "/home/domain1/serveV03.py", "max-procs" => 1, "bin-environment" => ( "REAL_SCRIPT_NAME" => "" ), "check-local" => "disable" )) ) server.document-root = "/home/domain1" url.rewrite-once = ( "^/favicon.ico$" => "/static/favicon.ico", "^/static/(.*)$" => "/static/$1", "^/(.*)$" => "/domain1.py/$1" ) } $HTTP["host"] =~ "(^|\.)domain2\.com$" { fastcgi.server = […]
如何将{REQUEST_URI}存储在variables中,对其进行处理,然后在RewriteCond或RewriteRule中使用它? 基本上,这是我期待的。 1.)获取{REQUEST_URI}并将.shtml改为.html,将其存储在名为URL_MOD的variables中 2.)testing新创build的名为URL_MOD的variables名称的文件是否存在 3.)根据testing结果,将用户redirect到URL_MOD追加的域。
有人能告诉我如何/为什么这个redirect不起作用? $HTTP["host"] =~ ".*\\.mydomain\\.com" { url.redirect = ( "/index\.php\?pg=mysql" => "http://mydomain.com/lean-webhosting/mysql-clustering/", "/index\.php\?pg=cloud_uitleg" => "http://mydomain.com/lean-webhosting/cloud-uitleg/" ) } 有人有任何想法? 谢谢!