Get the App
SLTechnology News&Howtos  ›  Servers  › 

How do I modify the default home page of the Apache server?

Shulou Source: shulou.com Published: 2022-06-03 06:04:03 09月21日 Update

1. Modify the default home page of the Apache server:

When accessing the Apache server, the default is to access the index.html in the htdocs directory directly, which is configured in conf/httpd.conf.

Found in conf/httpd.conf, the default content is as follows:

DirectoryIndex index.php index.html

When accessing the Apache server, it defaults to looking for files from here, first looking for index.php, and then looking for index.html. It can't find the Times and mistakenly says it has no access rights. According to this rule, you only need to set the file to be displayed in the first place.

2. The home page of the specified project is opened by default when accessing the Apache server:

To access the project under Apache, the access path is: http://localhost:80/ project name. Sometimes you need to access http://locahost to open the home page of the specified project. Here are two methods.

The first: put all the files of the project under htdocs, and set the home page to index.html or index.php. But this will be messy and inconvenient to manage. So it's not recommended.

The second kind: modify conf/httpd.conf file

The first step is to change the directory of DocumentRoot to the directory of the project. For example, if my project name is test and the directory is D:/Program Files/Apache Software Foundation/PHPWorkspace/test, then my DocumentRoot is:

DocumentRoot "D:/Program Files/Apache Software Foundation/PHPWorkspace/test"

The second step is to find "This should be changed to whatever you set DocumentRoot to." and put the

Tags: Project server home page service file directory content name that is permissions appearance path configuration same consistent two code article method Times Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Information NVidia Microsoft Apple