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

Modify the default path of apache server under linux

王林
王林 forward
2021-02-03 11:04:11 5521browse

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..

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

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

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

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

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

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!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete