Linux Nginx - how redirect port 80 to 443 (http to https)
Hi,
I would need to set up redirection on the linux webserver nginx as follows:
1.) anything on port 80 via http is redirected to port 443 with https
2.) what comes to port 88 from the inside stays on port 88
Thanks
Hi,
you could do such a redirect for the nginx webserver as follows:
I would need to set up redirection on the linux webserver nginx as follows:
1.) anything on port 80 via http is redirected to port 443 with https
2.) what comes to port 88 from the inside stays on port 88
Thanks
REPLY
Hi,
you could do such a redirect for the nginx webserver as follows:
server {
listen 80;
server_name app.cloud.up4.cz www.app.cloud.up4.cz;
return 301 https://$host$request_uri;
}
server {
listen 88;
root /var/www/is/www;
index index.php index.html;
server_name app.cloud.up4.cz www.app.cloud.up4.cz;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
client_max_body_size 999M;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
listen 444 ssl;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/www.app.cloud.up4.cz/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/www.app.cloud.up4.cz/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}