How to add default ports to apache in Linux

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.