我可以知道如何转发从端口80到443的所有请求吗? 我的代码:
server {
listen 80;
root /var/www/html/;
index index.html index.htm index.php;
server_name myexample.com;
location / {
proxy_pass http://myexample.com:443/;
}
}
server {
listen 443;
root /var/www/html/;
index index.html index.html index.php;
server_name myexample.com;
}
答案 0 :(得分:0)
将HTTP重定向到HTTPS
server {
listen 80;
server_name myexample.com;
return 301 https://$host$request_uri;
}
server {
listen 443;
root /var/www/html/;
index index.html index.html index.php;
server_name myexample.com;
}