How to disable http access and close 80 port for Apache (Linux)?

0 like 0 dislike
6 views
In a situation when you use only SSL connections, much sense to keep another port I think not.
by | 6 views

5 Answers

0 like 0 dislike
If there is a possibility that someone will forget about HTTPS and go by simply entering the website address, then for the love of users it makes sense to do the redirect.
\r
And in General:
1. Run ports in /etc/apache2/ports.conf:
\r
#Listen 80

\r
2. virthost rule in /etc/apache2/sites-available:
\r
\r... \r
by
0 like 0 dislike
# listen 80
by
0 like 0 dislike
leave port 80 open, but make unconditional redirect:
\rRedirect permanent / https://your.domain.ru/
So it will be easier to not have to type https:// before the address.
by
0 like 0 dislike
If the hosting ispmanager, then add port 8080 to the firewall/firewall.
If not, then to Google iptables, or something else that is on the server. This is the case with nginx 8080.
For all other cases, as correctly noted by amario, # listen 80
by
0 like 0 dislike
And in a situation when hanging with nginx on port 80 and Apache on 8080, how to close the port of the Apache all from the outside, leaving it only for nginx?

Using iptables you can do this:
iptables -A INPUT-i lo -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 8080 -j DROP
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
6 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
1,120 users