我正在努力完成。 在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 –