Start and Stop the apache service in Linux.

Source: Internet
Author: User

Start and Stop the apache service in Linux.

Author: Tyan
Blog: noahsnil.com | CSDN | short book

The Linux system used in this article is CentOS 7. The following describes how to start, disable, and set the apache service. Apache is generally installed by default in CentOS 7, and the service name ishttpd.

1. install apache and view related configuration
# Apache installation command $ sudo yum install httpdLoaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfilePackage httpd-2.4.6-45.el7.centos.4.x86_64 already installed and latest versionNothing to do # view apache File Location $ sudo find/-name httpd/run/httpd/etc/logrotate. d/httpd/etc/sysconfig/httpd/etc/httpd/var/log/httpd/var/cache/httpd/usr/sbin/httpd/usr/lib64/httpd/usr/ share/httpd/usr/include/httpd/usr/libexec/initscripts/legacy-actions/httpd

The Apache configuration file is located/etc/httpd/confThe main configuration file is/etc/httpd/conf/httpd.conf, Apache-related configuration information can be seen in this file.

2. Start and close the apache service
# Start the service $ sudo systemctl start httpd. service # view the service $ ps aux | grep httpdroot * 0.3 0.0 220444 4956? Ss/usr/sbin/httpd-DFOREGROUNDapache * 0.0 0.0 220444 2492? S/usr/sbin/httpd-DFOREGROUNDapache * 0.0 0.0 220444 2488? S/usr/sbin/httpd-DFOREGROUNDapache * 0.0 0.0 220444 2488? S/usr/sbin/httpd-DFOREGROUNDapache * 0.0 0.0 220444 2488? S/usr/sbin/httpd-DFOREGROUNDapache * 0.0 0.0 220444 2488? S/usr/sbin/httpd-DFOREGROUND # stop the service $ sudo systemctl stop httpd. service # restart the service $ sudo systemctl restart httpd. service

After starting the service, you can access the service through the IP address of the server on the Internet. You can see the following interface:

3. Configure the content that you can access externally

You can/var/www/htmlCreate a soft link, link to the content you want to access externally, and modify the permission to access the directory.

$ sudo ln -s your_path/images /var/www/html$ sudo chmod 755 images

Note:Make sure that all parent directories of images have permissions, and the path of images should be full path.

Top
0
Step on
0
View comments

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.