我试图使我的nginx服务器将任何www请求重定向到非www。在nginx服务器上,我使用docker在3003端口上运行react应用程序。这是我的配置:
server {
server_name www.example.com; # managed by Certbot
location / {
proxy_pass http://localhost:3003; # 8030 is the port the Docker container is running on
proxy_set_header Host $host;
试图在这里使用Nginx作为反向代理。这就是我想要达到的目标:
将example.com和www.example.com重定向到https://example.com。
将请求代理到另一个端口。
以下是流程:example.com -> Nginx -> Go web server listening on port 5000
重写似乎工作正常,因为在浏览器中我得到了https://example.com,但是我在浏览器中得到了这个错误:
ERR_TOO_MANY_REDIRECTS
如果有关系,我的DNS设置是这样的:
@ - A - 11.XX.XX
我正在尝试将所有网站流量重定向到我想要的https://example.com.:
https://example.com
https://www.example.com
http://example.com
http://www.example.com
example.com
www.example.com
to all redirect to `https://example.com`
现在,如果我直接输入https://example.com,它就可以工作。
但是,如果我键入非SSL example.com或www.example.com或或,则会出现以下错误:
This site c
我试图在Ubuntu16.04上加密Nginx。
获得SSL证书之前的example.conf文件
server {
server_name example.com www.example.com ;
# Tell Nginx and Passenger where your app's 'public' directory is
root /var/www/backup/mycode/public;
# Turn on Passenger
passenger_enabled on;
rails_env developme
我使用了Facebook共享调试器来突出网站上的一个问题。
URL requested a HTTP redirect, but it could not be followed.
这也阻止了它在创建应用程序时接受隐私策略中的url。
我已经研究并确保添加所有的OG元标签。我还“减少”了nginx上的重定向,使其只支持http > https重定向,对我来说这似乎相当标准。
它仍然会在调试器和隐私策略URL上产生错误。
我的Nginx配置:
server_tokens off; #Enables or disables emitting nginx version on erro
尝试将位置从https重定向到http时,浏览器中出现了重定向循环。 附言:我已经安装了certbot (让我们加密)来获取ssl证书。 我尝试了不同的服务器块,相同的服务器块,返回301,重写,但似乎没有什么效果。 server {
root /usr/share/nginx/www;
index index.html index.htm index.php;
server_name example.com;
# Make site accessible from http://localhost/
location / {
我试图在Ubuntu16.04上加密Nginx。
获得SSL证书之前的mydomain.conf文件
server {
server_name mydomain.com www.mydomian.com ;
# Tell Nginx and Passenger where your app's 'public' directory is
root /var/www/backup/mycode/public;
# Turn on Passenger
passenger_enabled on;
rails_env develo
我试图在Ubuntu16.04上加密Nginx。
获得SSL证书之前的example.conf文件
server {
server_name example.com www.example.com ;
# Tell Nginx and Passenger where your app's 'public' directory is
root /var/www/backup/mycode/public;
# Turn on Passenger
passenger_enabled on;
rails_env developme