Home > Operation and Maintenance > Apache > Modify the default path of apache server under linux

Modify the default path of apache server under linux

王林
Release: 2021-02-03 11:04:11
forward
5736 people have browsed it

Modify the default path of apache server under linux

Introduction:

Apache (transliterated as Apache) is the world's number one Web server software. It can run on almost all widely used computer platforms and is one of the most popular web server-side software due to its cross-platform and security features. It is fast, reliable and can be extended through a simple API to compile interpreters such as Perl/Python into the server.

The specific method is as follows:

1: Check whether apache has been installed on the server, stop and uninstall the system's own apache service

The command is:

rpm -qa|grep httpd
rpm -e --nodeps httpd-tools..
Copy after login

Modify the default path of apache server under linux

2: After the uninstallation is completed, upload all the packages required for httpd service installation

Modify the default path of apache server under linux

The installation package cloud disk address is: http: //pan.baidu.com/s/1qYTgomo Password: nk7z

I uploaded it to the /usr/local directory, then decompressed and installed

Three: Install the above installation packages in order Installation

Install apr, solve the problem of apr not found

Modify the default path of apache server under linux

##Install apr-util, solve the problem of apr-util not found

Modify the default path of apache server under linux

Install pcre and solve the problem of pcre not found

Modify the default path of apache server under linux

Install httpd

[root@zdhcs5 local]# tar zxvf httpd-2.4.7.tar.gz
[root@zdhcs5 local]# cd httpd-2.4.7
[root@zdhcs5 httpd-2.4.7]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre  (除了指定Apache的安装目录外,还要安装apr、apr-util、pcre,并指定参数)
[root@zdhcs5 httpd-2.4.7]# make
[root@zdhcs5 httpd-2.4.7]# make install
Copy after login

Four: Start the apache service and verify that the installation is successful, browse When the "it works" appears when entering the URL into the browser, the installation is successful

1 [root@zdhcs5 bin]# cd /usr/local/apache2/bin/
2 [root@zdhcs5 bin]# ./apachectl start
Copy after login

Modify the default path of apache server under linux

5: Modify the apache default display path to a custom path

My custom path is an automated result Report path, that is, you can see the automation result report running on the Linux server by opening the URL

My custom automation result report path is (under the autotest user): /home/autotest/workspace/auto-project /test-output/html

There are two things that need to be modified when modifying the apache configuration file:

1 [root@zdhcs5 local]# vi /usr/local/apache2/conf/httpd.conf
Copy after login

The first part: modify the path


Before modification:

Modify the default path of apache server under linux

After modification:

Modify the default path of apache server under linux

Second point: Modify the user and group, the reason why the daemon user is modified to autotest It is to allow apache to have permission to access my custom path, because my custom path is under the autotest user

Before modification:

Modify the default path of apache server under linux

After modification:

Modify the default path of apache server under linux

Save and exit, restart the apache service:

1 [root@zdhcs5 local]# cd /usr/local/apache2/bin
2 [root@zdhcs5 bin]# ./apachectl stop
3 [root@zdhcs5 bin]# ./apachectl start
Copy after login

After successful startup, in order to prevent the error report of no permission when accessing the address in the browser, we still need to modify it The permissions of the entire path of the custom file are 755

The custom path is configured as above:/home/autotest/workspace/auto-project/test-output/html

Use the autotest user to execute the following Command: (autotest is the user of your custom path), according to the actual modification,

1 [autotest@zdhcs5 html]$ chmod -R 775 /home/autotest/workspace/auto-project/test-output/html
Copy after login
Then go to the browser to verify whether it is successful, refresh the browser address just now:

Modify the default path of apache server under linux

Now you have installed apache under Linux and modified the default path to a custom path.

Related recommendations:

apache tutorial

The above is the detailed content of Modify the default path of apache server under linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template