How to modify the port in Apache 2.4.7.


Why write this article?

Mainly online nowapacheThe methods of port modification are all long ago. I followed the above methods to modify. If I can’t find the file, or there is no content in the file, I have to grope for it. After a long time of trying, I can finally do it. So I want to write down the methods and give a reference to the friends who want to modify the port later.

First, open./etc/apache2/ports.conf

Note: if you are prompted that the file is read-only, use the command sudo Chmod 777. If you also see the prompt below, use the command.

How to modify the port in Apache 2.4.7.

apacheThe default port in is80Port, as shown in the figure above80, you can change it to any port80Replace with the port you want to modify.

Then go to/etc/apache2/sites-available/000-default.conf

How to modify the port in Apache 2.4.7.

Also modify the80(this is at the beginning of the file)

How to modify the port in Apache 2.4.7.

Then change the position in the figure above. implementsudo service apache2 restartrestartapacheYes.

Finally, if you are using Tencent cloud server, then80The port is blocked by default.

Why should I modify the port? It’s a pit. When Alibaba cloud was used before80The port has been opened. I forgot to use Tencent cloud this time. How to set an open80In fact, the security group of the port is still simple. You can google it.

Recommended Today

PHP Basics – String Array Operations

In our daily work, we often need to deal with some strings or arrays. Today, we have time to sort them out String operation <?php //String truncation $str = ‘Hello World!’ Substr ($STR, 0,5); // return ‘hello’ //Chinese string truncation $STR = ‘Hello, Shenzhen’; $result = mb_ Substr ($STR, 0,2); // Hello //First occurrence of […]