S
S
Sergey Pozdnyakov2016-09-22 11:01:27
Nginx
Sergey Pozdnyakov, 2016-09-22 11:01:27

How to redirect from one port to another?

Good day!
There is a server on which there is a bunch of nginx + apache2, Apache has two hosts on ports 8080 and 8083 for http and https, respectively. The problem is that pages with the port - site.ru:8083 got into the Yandex index . And by http protocol. When we click on the link, we get

Bad Request

Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.

Tried to add lines in virtualhost on port 8083
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

It didn’t help, Apache doesn’t even seem to get there, are there options for how to cure it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Leonid Knyazev, 2016-09-22
@Afinogen

If you "have a bunch of nginx + apache2", then why does apache2 respond to external requests?
In theory, nginx should be responsible for processing external http:80/https:443 requests, and if necessary, proxy them locally to apache2. And, apache2, in turn, should only listen to local requests and be inaccessible from the outside.
Then the search engines will not see pages with different ports.
As an option, correctly configure apache2 / nginx and hosts, configure robots.txt and wait for a while until the search engines re-index the site.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question