This article summarizes the methods for adding default ports to apache in Linux and the methods for modifying the default ports of apache mysql and other services after the addition. If you need a solution, please refer
The Code is as follows: |
Copy code |
/Etc/sysconfig/iptables |
Change
The Code is as follows: |
Copy code |
/Etc/httpd/conf/httpd. conf |
File
Find
The Code is as follows: |
Copy code |
# Listen 12.34.56.78: 80 Listen 80 Listen 66 # default port I added |
Save Modification
The Code is as follows: |
Copy code |
Semanage port-a-t http_port_t-p tcp 66 |
# Enter this command or the httpd will fail to start.
And so on ..
The Code is as follows: |
Copy code |
./Etc/rc. d/init. d/httpd start # start httpd |
The default port cannot be started properly after services such as apache mysql are modified
The solution is as follows:
Method 1: Disable SELinux
This is the fastest and most direct method, which is also commonly used by many people. The disadvantage is that the system security is sacrificed.
You can disable SELinux or set SELinux mode to tolerant mode.
Method To completely close:
The Code is as follows: |
Copy code |
$ Vim/etc/selinux/config
|
Add a # sign before SELINUX = enforcing to comment it out.
# SELINUX = enforcing
Add a new row.
The Code is as follows: |
Copy code |
SELINUX = disabled
|
Save, exit, and restart the system
How to Set it to the tolerant mode:
The Code is as follows: |
Copy code |
$ Setenforce 0 |