I am having issues redirecting content with http://www.example.com. In other words, http://example works fine and redirects to https, but http://www.example.com does not.
Below is my nginx config
server {
listen 80;
listen [::]:80;
server_name example.com;
return 301 https://www.example.com$request_uri;
}
server {
listen 80;
listen [::]:80;
server_name www.example.com;
return 301 https://www.example.com$request_uri;
}
server {
listen 443 ssl http2;
server_name www.example.com;
sendfile on;
ssl_certificate /usr/share/example_chain.crt;
ssl_certificate_key /usr/share/7a45ae3816f4bc8f.pem;
default_type application/octet-stream;
gzip on;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6]\.";
gzip_min_length 256;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-
javascript text/xml application/xml application/xml+rss text/javascript;
gzip_comp_level 9;
root /usr/share/nginx/html;
location / {
try_files $uri $uri/ /index.html =404;
}
}
In addition, I have a docker container that serves request from port 443 on my ec2 instance to port 443 inside the docker container.
Before I had this ->
server {
listen 80;
listen [::]:80;
server_name www.example.com example.com;
return 301 https://www.example.com$request_uri;
}
Aucun commentaire:
Enregistrer un commentaire