我有这个文件夹:/ home / sites / dev / Nginx服务这个文件夹的内容,如果我访问“domain.com” 但是,让我们说,如果我在这个文件夹内创build一个文件夹,例如“wp-test”,我想让nginx服务这个文件夹,如果我访问“wp-test.domain.com” 看起来像“ianc”使他的博客文章工作 ,但我不能得到它的工作。 这是我的configuration到目前为止nginx: server { listen 80; server_name www.ilundev.no; root /home/sites/dev; } server { listen 80; server_name ~^(.*)\.ilundev\.no$; if (!-d /home/sites/dev/ilundev.no/public/$1) { rewrite . http://www.ilundev.no/ redirect; } root /home/sites/dev/$1; } server { listen 80; server_name ilundev.no; rewrite ^/(.*) http://www.ilundev.no/$1 permanent; }
我有一个运行两个子域的Nginx服务器。 其中一个使用proxy_pass将所有内容redirect到Meteor应用程序,而另一个子域只使用Laravel,但是与普通域名不同。 所以,当我启动./letsencrypt-auto我得到了两个子域的以下错误消息: Failed authorization procedure. subdomain.mydomain.com (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://subdomain.mydomain.com/.well-known/acme-challenge/xyzxyzxy_xzyzxyxyyx_xyzyxzyxz: "<html> <head><title>404 Not Found</title></head> <body bgcolor="white"> <center><h1>404 Not Found</h1></center> 我的解释是,这是行不通的,因为我的Laravel子域不在/var/www/domain.com/html但在/var/www/laravel/html和我的meteor应用程序是somwhere其他和ngnix只是代理传递。 所以我的问题是:我可以redirect/.well-known/acme-challenge两个子域名/知名/ acme-challenge真正的/ .well- known,让letsencrypt-auto不会抛出这个错误? 更多信息: 我试过了 location '/.well-known/acme-challenge' { default_type "text/plain"; root /tmp/letsencrypt-auto; } 但它没有工作… configuration我的Meteor子域: server { listen 80; listen [::]:80; # SSL configuration […]
我有一堆的子域http://product.domain.com ,我想redirect到http://www.domain.com/product 。 当然,产品名称可能不同,redirect也必须相应完成。 任何指针? 谢谢
好吧,我似乎无法得到它,我检查了nginx论坛,也没有太多的帮助。 我认为这将是简单的。 我想定义的子域名转到不同的url/端口。 即 DNS site.com goes to 192.168.1.1 w/ masking DNS www.site.com goes 192.168.1.1 w/ masking DNS red.site.com goes 192.168.1.1 w/ masking DNS blue.site.com goes to 192.168.1.1 w/ masking 我希望site.com和www.site.com正常运行,但我想red.site.com去192.168.1.2:5000和blue.site.com去192.168.1.2:6000/temp/ 等等等等……我甚至不确定我在意地址栏中显示的是什么,我想如果它保持在red.site.com,它会很好,但这并不重要。 我试过一个代理传递一个URL重写,显然我做错了什么。 这甚至有可能吗?
我有一个与Nginx的Web服务器,我需要configurationajenti打开像一个子域,如下所示: https://ajenti.mydomain.com/ 这可能吗? 谢谢!
我正在尝试为pipe理页面设置子域路由。 然而,当使用admin.localhost我能够路由到子域就好了。 当我使用lvh.me我路由到正确的主页,虽然当使用admin.lvh.me我路由到相同的主页,而不是pipe理员login页面。 # config/routes.rb constraints(AdminSubdomain) do constraints subdomain: 'admin' do devise_for :admins devise_scope :admin do authenticated :admin do root to: 'admin_home#index', as: :authenticated_root end unauthenticated do root to: 'devise/sessions#new', as: :unauthenticated_root end end resources :example resources :example end end 其他路由子域参数我试过了 module: "admin", path: "/", constraints: lambda { |r| r.subdomain.split('.')[0] == 'admin' } do […] […]
问题 在创build帐户时,我希望用户以username.domain-name.com的身份访问他们的个人资料 我也有网站function: username.domain-name.com/feature1 username.domain-name.com/feature2 username.domain-name.com/feature3 如果上面的用户允许他访问,上面的链接可能有其他用户可以访问的内容。 例如: user1.domain-name.com/feature1 ,这里user1已经授权访问user2因此,user2已经login并访问user1.domain-name.com/feature1他应该能够看到内容。 我的研究到目前为止: 我尝试了以下链接: https://kadira.io/blog/meteor/sharing-meteor-login-state-between-sub-domains https://github.com/jfrolich/meteor-subdomain-persistent-login 读了很多之后,我发现meteor有localStorage作为存储用户login信息的方式。 所以,我必须设法将细节传递给子域。 我也尝试在nginxconfiguration中使用proxy_pass来执行以下操作:请求: username.domain-name.com/feature1应该被代理(不重新指定URL将是相同的) domain-name.com/username/feature1 如果有人在这里介绍一下我应该使用的方法真的会对我有所帮助。 我知道这个devise可能不适合search引擎。 更新 我现在成功地使用了以下devise:如果user1在domain-name.com上login并且想要访问他自己的configuration文件页面,如user1.domain-name.com/profile。 第一步:user1访问user1.domain-name.com/profile它redirect到domain-name.com,其中user1在localstorage中有会话,然后阅读HTTP标头referrer我得到user1.domain-name.com/profile并准备新的url:user1。 domain-name.com/profile?token=userToken(我可能会创build另一个临时标记在数据库中,只需点击一下exp。) 第2步:redirect到新的urluser1.domain-name.com/profile?token=userToken,使用get参数我在localstorage中创build新的会话,并将user1redirect到user1.domain-name.com/profile。 这是非常规的解决scheme,我仍然在重新寻找。
所以我有两个域 – www.mysite.com和sub.mysite.com sub.mysite.com被许多旧版应用程序所使用,这些应用程序由于各种原因无法更新,并且他们对该url上的URL的请求需要继续工作。 但是,代码正在从sub.mysite.com的Rails应用程序中移除,并将被整合到www.mysite.com 目前的计划是在www.mysite.com/sub上提供sub.mysite.com内容,但是如何让nginx从www.mysite.com/sub上呈现内容就好像它来自sub.mysite.com 我已经在nginxconfiguration中尝试了一些重写规则,但是他们一直将我redirect到www.mysite.com/sub URLs,而不是坚持使用sub.mysite.com地址。 在我的nginxconfiguration的底部,我目前有: server{ listen 80; server_name sub.mysite.com; location / { proxy_redirect off; proxy_pass http://www_server/sub; } } 我甚至要求甚么?
我有一个网站(例如:test.com),它有两种子域名: test.com 静_ $ {}版本.test.com 第一个是主子域,第二个仅用于静态文件(js / css / image)。 ${version}是一个版本号,当有新版本的js / css / images文件的时候会改变,我需要它,因为客户端可能会caching旧版本。 现在我使用nginx,但是我没有test.com域进行configuration,只是简单地将所有子域重写到主test.com域。 它的工作原理,但有一天,我发现了一个search引擎,使用static.test.com作为主要域名访问我的网站。 如何configurationnginx,让static.test.com只能访问静态文件,而主域可以访问所有的? UPDATE 我希望static.test.com与js / css / images的请求将重写到test.com ,而不是磁盘上的静态文件。 和其他请求(不是js / css /图像)将直接返回404 。 感谢Timofey Stolbov的回答 ,我现在写一个configuration: server { listen 80; server_name ~^static_(.*)\.test\.com$; set $version $1; rewrite ^/public/(.*) http://test.com/public/$1?v=$version last; return 404; } 由于我的js / css / images文件都在“public”目录下,所以我只是检查它是否以“public”开头。 如果没有,只需返回404。 […]
以下是前提条件: 我在godaddy注册了域名example.com 。 我运行一个Tomcat在8080端口与几个应用程序。 8080港口是隐藏在世界的。 我想将subdomain.example.com映射到server:8080/subdomain 。 我希望将来可以做类似的映射(比如subdomain2.example.com到server:8080/anotherContext )。 example.com应映射到server:8080/mainPageApp 所有其他应用程序应该可以通过它们的上下文访问: example.com/app – > server:8080/app 。 现在,我只configuration了godaddy(我不知道这是否好): 你能帮我用nginx config这个案子吗? 这是我的,但它发送无限的redirect: server { listen 80; server_name localhost; location / { root html; index index.html; } } server { listen 80; server_name subdomain.localhost; location / { proxy_pass http://127.0.0.1:8080/subdomain; } }