我正在努力完成。 在https上有一个域。检查。它使用下面的配置工作正常。烧瓶应用程序运行在端口1337 - > nginx需要它 - >通过https服务它。一切正常工作Nginx - 在https上服务瓶python和另一个端口没有https
现在我想运行另一个应用程序,端口1338让我们说。但如果我这样做,浏览器(chrome)会自动将其重定向到https。 我想:http://domain.com:1338 ....运行OK 我得到:https://domain.com:1338 ...错误证书
我的问题是:如何才能让其他应用程序(在端口1338),无论是工作,https://或以http工作://
这里是我的配置...
server {
listen 80 default_server;
listen [::]:80 default_server;
root /home/cleverbots;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
# SSL configuration
#
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
ssl_certificate /xxxxxxxxxx.crt;
ssl_certificate_key /xxxxxxxxxx.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
ssl_ecdh_curve secp384r1;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 5s;
# Disable preloading HSTS for now. You can use the commented out header line that includes
# the "preload" directive if you understand the implications.
#add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains";
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
ssl_dhparam /xxxxxx/dhparam.pem;
location /static/ {
expires 30d;
add_header Last-Modified $sent_http_Expires;
alias /home/my_first_app/application/static/;
}
location/{
try_files $uri @tornado;
}
location @tornado {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:1337;
}
}
如果你想要这个程序是通过浏览器对公众开放,那么你就需要添加一个子域为它监听80端口上。如果你只是将它用于API调用(比如说),那么你可以在自定义端口上创建一个新的服务器模块,然后让Nginx代理它到端口1338 –