An error is reported when the apache port cannot be restarted when it is modified in centos.

Source: Internet
Author: User
Tags ssh port

In centos, apache uses the default port 80. Now we want to change the port to 9191, for example, an error will be reported,

The error message is as follows:

(13) Permissiondenied: make_sock: couldnotbindtoaddress [:]: 9191
(13) Permissiondenied: make_sock: couldnotbindtoaddress0.0.0.0: 9191


This is because the PORT command we want has not been opened, so we need to perform the following two steps.

1. Install the semanage management tool. skip this step if you have installed the tool.

First use: semanageport-l | grephttp to see if there is no 9191 results, if not, use the following sentence plus: semanageport-a-thttp_port_t-ptcp9191


2. Copy the line "vi/etc/sysconfig/iptables" 80 "and change" 80 "to" 9191.

Then restart the firewall: serviceiptablesrestart


Restart apache again. servicehttpdrestart



Note: Some friends do not know where semanage is installed. I will attach it below:

Appendix: semanage1. install semanage. By default, CentOS does not have this command. You need to check who provided this command.
Yumprovides/usr/sbin/semanage and then install the yum-yinstallpolicycoreutils-python2.semanage to use the protcontext, for example, to view the ssh port status semanageport-l | grepssh should be possible to the following results: ssh_port_ttcp2345, 22


Related Article

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.