Reputation: 1323
I try to redirect HTTPS request to HTTP using NGINX.
This how I edited
/etc/nginx/sites-available/default
on my 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;
}
}
So any ideas what i have done wrong?
Upvotes: 2
Views: 6391
Reputation: 3270
You need to listen on port 443 (HTTPS) and redirect to HTTP. You don't have anything showing that you're listening on 443.
Try this instead:
server {
listen 443;
server_name exapmle.com;
rewrite ^(.*) http://example.com$1 permanent;
}
Upvotes: 3