我正在尝试使用Nginx提供Autodiscover.xml文件: 以下是我的configuration: 上游autodiscoverexamplecoukbackend { server unix:/var/run/php-fcgi-autodiscoverexamplecouk.sock; } 服务器{ 听80; 听443 ssl; ssl_certificate /etc/letsencrypt/live/autodiscover.example.co.uk/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/autodiscover.example.co.uk/privkey.pem; server_name autodiscover.example.co.uk; root /var/www/vhosts/autodiscover.example.co.uk/htdocs; index index.html; error_log /var/www/vhosts/autodiscover.example.co.uk/error.log; access_log /var/www/vhosts/autodiscover.example.co.uk/access.log合并; #位置^〜/ autodiscover / { #index autodiscover.php; #rewrite ^ /。* $ /autodiscover.php last; #} 位置〜* / autodiscover / { 重写^ / autodiscover / autodiscover \ .xml $ /autodiscover/autodiscover.php最后; } location = […]
我目前在Fedora 25 Server Edition x86_64上使用Nginx 1.10.2来托pipe一些小的静态网站。 我已经configurationNginx假定没有文件扩展名的请求( try_files )为.html ,并且如果.*\.html被请求,则redirect(永久rewrite )到URL的.html -less版本。 我也有自定义错误页面。 据我可以告诉到目前为止, error_page指令不配合重写,因为我被卡住redirect循环的网页,应该返回一个正常的错误信息…我相信这是所有相关的configuration: server { […] try_files $uri $uri.html $uri/index.html =404; error_page 400 /errors/400.html; error_page 401 /errors/401.html; error_page 403 /errors/403.html; error_page 404 /errors/404.html; error_page 408 /errors/408.html; error_page 500 /errors/500.html; error_page 503 /errors/503.html; # Remove "index" from URL if requesting the front page. rewrite […]
我想重写一个URL使用重写。 我想插入一个URL到请求的URI但是:这是http:的一部分正在越狱,我的应用程序永远不会得到正确的URL。 如何在重写时防止转义? rewrite /(.*)url(.*) /$1http://example.com$2 break; 导致; /abc/http%3A//example.com/myfile.html 而应该是; /abc/http://example.com/myfile.html
我有一个由Nginx服务的PHP网站。 我希望能够通过不同的子文件夹访问它。 基本上,用户可以注册,当他们select设置一个“url”。 基于此,他们将访问这样的网站: example.com/{url} 我也可以这样做: example.com/s/{url} 如果这将有助于检测它。 我想让Nginx抓住这个URL并使用fastcgi_param将它传递给PHP。 另外,我希望PHP的行为就像是通过example.com访问网站。 例如, example.com/s/{url}/about将与example.com/about相同。
我有一个应用程序,所有到URLpath/playback的stream量必须由PHP脚本authCheck.php 。 这是好的,但我需要保留在浏览器中的原始URL的CSS URL标签: RewriteRule ^/playback/(.*)$ http://%{HTTP_HOST}/authCheck.php?file=proxy/playback/$1 [NC] <Proxy *> Order deny,allow Allow from all #Require ip 127.0.0.1 </Proxy> Header add "Access-Control-Allow-Origin" "*" ProxyPass /proxy/playback https://clientdomain/playback ProxyPassReverse /proxy/playback https://clientdomain/playback 任何人都知道如何做到这一点?
我一直在尝试使用URL重写将URLredirect到另一个域。 以下是我的nginx.conf文件: worker_processes 1; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; server { listen 8070; server_name www.example.com; rewrite ^/v1/([0-9]+).html http://www.example.com/v1?exid=$1; location ~ /v1/([0-9]+) { return 301 http://dev.example1.com/v1?exid==$1; } } } 我一直在尝试很长一段时间,但我仍然无法find合适的解决scheme。 注:我没有得到任何错误,如果我尝试以上,但预期的redirect不会发生。 我希望将此urlredirect到http://example.com/v1/68740.html —至—> http://dev.example1.com/v1?exid=68740 。 提前致谢。
我无法将.htaccess转换为nginxconfiguration。 我一直在尝试使用在线转换工具。 .htaccess转换如下: RewriteEngine on RewriteCond %{REQUEST_URI} !/public RewriteCond %{REQUEST_URI} !/index.php RewriteRule ^(.*)$ index.php/?params=$1 [NC] 我一直在尝试使用下面的nginxconfiguration: location / { rewrite ^(.*)$ index.php/?params=$1; } 这只是不正常的工作。 它也允许访问这个目录中的其他文件。 我只想要index.php可用。 甚至需要使用.htaccess规则。 在生产服务器上不能安装apache / httpd。 而且我不想浪费资源在docker中运行apache。
在我的开发服务器上,仅使用证书login(443上的HTTPS),而80上的HTTPredirect到HTTPS。 没有redirect访问不受限制,每个人都可以去任何地方,因为我不能做“要求”在HTTP上,而不是HTTPS,因为“要求”只适用于LOCATION / FILE而不是VHOST。 可以信任redirect总是拒绝访问HTTP? 它足够安全吗? 相关设置: 在位置/ var / www / html /中: Require All granted Options Indexes FollowSymLinks 在虚拟主机[服务器IP]:80 RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L] 在虚拟主机[服务器IP]:433 SSLVerifyClient require
我试图build立一个NGINX代理,根据查询string参数的内容将所有请求redirect到两台服务器之一。 主要有: https://my.site.com/api/…&server=a 应该redirect到 https://a.site.com/api/…&server=a 和 https://my.site.com/api/…&server=b 应该redirect到 https://b.site.com/api/…&server=b 我似乎有一个configuration,执行重写主机名和保持查询string完整的基本工作: error_log /dev/stdout info; worker_processes 1; events { worker_connections 1024; accept_mutex off; } http { access_log /dev/stdout combined; sendfile on; server { listen 443 ssl; server_name $hostname; ssl_certificate /etc/ssl/nginx.crt; ssl_certificate_key /etc/ssl/nginx.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers HIGH:!aNULL:!MD5; location ~ /api/ { if ($arg_server !~ "^(a|b)$") { […]
是否有可能重写/代理一个URL到另一个具有不同path的URL? 它不应该只是一个redirect,而应该是其他URL的内部代理,以便浏览器地址栏只显示原始URL。 请注意,这两个url的域名/主机名称会有所不同。 请build议。 eg Rewrite or Proxy from, https://www.example1.com/a/b to https://www.example2.com/p/q/r