[英]NGINX redirect HTTPS to HTTP
我尝试使用NGINX将HTTPS请求重定向到HTTP。
这是我的编辑方式
在/ etc / nginx的/网站可用/默认
在我的VPS上:
server {
listen 443;
server_name exapmle.com;
rewrite ^(.*) http://example.com$1 permanent;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/laravel/public;
index index.php index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com;
if ( $https = "on" ) {
return 301 http://www.example.com$request_uri;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
所以有什么想法我做错了吗?
您需要侦听端口443(HTTPS)并重定向到HTTP。 您没有任何显示您正在监听443的信息。
尝试以下方法:
server {
listen 443;
server_name exapmle.com;
rewrite ^(.*) http://example.com$1 permanent;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.