Sto eseguendo un'applicazione Sinatra dietro a passenger/nginx. Sto cercando di farlo rispondere a entrambe le chiamate http e https. Il problema è che, quando entrambi sono definiti nel blocco del server, le chiamate https sono normalmente soddisfatte, ma l'HTTP restituisce un errore 400 "La richiesta HTTP semplice è stata inviata alla porta HTTPS". Questo è per una pagina statica quindi immagino che Sinatra non abbia nulla a che fare con questo. Qualche idea su come risolvere questo problema?Gestione di nginx 400 "La semplice richiesta HTTP è stata inviata alla porta HTTPS" Errore
Ecco il blocco del server:
server {
listen 80;
listen 443 ssl;
server_name localhost;
root /home/myhome/app/public;
passenger_enabled on;
ssl on;
ssl_certificate /opt/nginx/ssl_keys/ssl.crt;
ssl_certificate_key /opt/nginx/ssl_keys/ssl.key;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers HIGH:!aNULL:!MD5;
location /static {
root /home/myhome/app/public;
index index.html index.htm index.php;
}
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
error_page 500 /500.html;
access_log /home/myhome/app/logs/access.log;
error_log /home/myhome/app/logs/error.log;
}
Ti suggerisco di accettare la risposta data da @bobojam –
Nel mio caso l'url nel browser: "my.example.com: 443' non ha funzionato. Cambiando quello invece su 'https: // my.example.com' funzionava. Strano, non ha mai avuto questo problema con Apache. – Sebastian
'ssl on;' dice NGINX al server ** QUALSIASI ** contenuto tramite SSL. Usa il flag "ssl" alla fine del tuo 'listen 443; 'e.g' ascolta 443 ssl; 'se il tuo server eroga sia il traffico http e https, e rimuove la direttiva' ssl on; '. – Stphane