Centos7 Installing httpd and PHP

Source: Internet
Author: User
Tags rsyslog

Centos7 Many of the commands have changed and have to be remembered again.

Centos7 the httpd is installed by default? Don't remember, look at:

Rpm-qa |grep httpd

If not, please install it.

Yum-y Install httpd

Yum-y Install PHP

Yum-y Install PHP-GD php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp Php-soap Curl Curl-devel

Second, start the httpd service, and set the boot to boot.

Systemctl Start Httpd.service

Systemctl Enable Httpd.service

at this point, the configuration file is linked to the/etc/systemd/system/multi-user.target.wantstpd.service, as
ll/etc/systemd/system/multi-user.target.wants/
Total 0
lrwxrwxrwx. 1 root root (SEP) 19:08 Auditd.service-/usrb/systemd/system/auditd.service
lrwxrwxrwx. 1 root root: Sep-19:08 avahi-daemon.service-/usrb/systemd/system/avahi-daemon.service
lrwxrwxrwx. 1 root root Notoginseng Sep 19:08 crond.service-/usrb/systemd/system/crond.service
lrwxrwxrwx. 1 root root Notoginseng Sep 02:38 httpd.service-/usrb/systemd/systemtpd.service
lrwxrwxrwx. 1 root root Sep 19:08 Irqbalance.service-/usrb/systemd/system/irqbalance.service
lrwxrwxrwx. 1 root root Notoginseng Sep 19:08 kdump.service-/usrb/systemd/system/kdump.service
lrwxrwxrwx. 1 root root (SEP) 19:08 Networkmanager.service-/usrb/systemd/system/networkmanager.service
lrwxrwxrwx. 1 root root-19:08 Postfix.service-/usrb/systemd/system/postfix.service
lrwxrwxrwx. 1 root root-19:08 remote-fs.target-/usrb/systemd/system/remote-fs.target
lrwxrwxrwx. 1 root root-19:08 Rsyslog.service-/usrb/systemd/system/rsyslog.service
lrwxrwxrwx. 1 root root (SEP) 19:08 Sshd.service-/usrb/systemd/system/sshd.service
lrwxrwxrwx. 1 root root Notoginseng Sep 19:08 tuned.service-/usrb/systemd/system/tuned.service Third, open FIREWALLD firewall port firewall-cmd--add-service=http even open firewall-cmd--permanent--add-service=http Writing the configuration file at this point, httpd This service is added to the/etc/firewalld/zones/public.xml zone configuration file, so FIREWALLD can be released accordingly. This file resembles the following:
<?xml version= "1.0" encoding= "Utf-8"?>
<zone>
<short>Public</short>
<description>for use on public areas. You don't trust the other computers in networks to not harm your computer. Only selected incoming Connections is accepted.</description>
<service name= "dhcpv6-client"/>
<service name= "http"/>
<service name= "ssh"/>
<service name= "https"/>
</zone>
 
be careful not to confuse the service Firewalld managed here with the Sevice hive in Systemd, which does not have any relationship.
 
The HTTP service is installed automatically when installing FIREWALLD, the configuration file for this service is/usrb/firewalldrvicestp.xml, let's take a look at this file.
<?xml version= "1.0" encoding= "Utf-8"?>
<service>
<short>www (HTTP) </short>
<description>http is the protocol used to serve Web pages. If you plan to make your WEB server publicly available, enable the This option. This option isn't required for viewing pages locally or developing Web pages.</description>
<port protocol= "tcp" port= "/> "
<rvice>
This means that the HTTP service corresponds to port 80 of the TCP protocol. Firewalld according to the service name HTTP in the zone configuration file, in the/etc/firwalldrvices/directory, the/usrb/firewalldrvices/directory to find the file named Http.xml, found to stop the search, so located/ The configuration file for the etc/firwalldrvices/directory has a higher precedence.
 
the difference between 4 and CentOS6.5
The general idea is consistent, is the firewall release, the service to join the run-level configuration file. Just CentOS7 the firewall and the run-level hypervisor are completely changed. Firewalld instead of IPTABLES,SYSTEMD instead of SYSTEMV init, so you need to be familiar with the commands again. The individual feels that the new procedure is more humane and easy to operate. The configuration file also uses the standard XML format, discarding the old, error-prone configuration file.

Centos7 Installing httpd and PHP

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.