Detailed explanation of how to configure secondary domain name on Apache server under Linux environment

Detailed explanation of how to configure secondary domain name on Apache server under Linux environment

This article describes how to configure a secondary domain name on an Apache server in a Linux environment. Share with you for your reference, the details are as follows:

(Take the domain name www.csdn.net as an example, now you need to configure a secondary domain name blog.csdn.net to point to the host address)

First, make sure to enable the mod_rewrite module in the Apache configuration file httpd.conf:

Here is a brief introduction to this module:


Next, we need to log in to the domain name management backend of the purchased domain name operator and click 'Domain Name Resolution':


Manually add or quickly add the following two default resolutions with one click. Domain names such as www.csdn.net and csdn.net can access the host address.

Add a secondary domain name resolution that needs to be configured:

Then add the following domain name configuration at the end of the Apache configuration file httpd.conf:

<VirtualHost *:80>
  ServerAdmin [email protected]
  DocumentRoot /usr/local/apache/htdocs
  ServerName www.csdn.net
  ServerAlias ​​www.csdn.net csdn.net
  DirectoryIndex index.php index.html index.htm  
</VirtualHost>
<VirtualHost *:80>
  ServerAdmin [email protected]
  DocumentRoot /usr/local/apache/htdocs/blog
  ServerName blog.csdn.net
  ServerAlias ​​blog.csdn.net
  DirectoryIndex index.php index.html index.htm  
</VirtualHost>

Restart Apache, and then the secondary domain name such as blog.csdn.net can be accessed

I hope this article will help you configure your Linux server.

You may also be interested in:
  • Apache secondary domain name resolution (windows and linux)
  • Linux Apache wildcard domain name resolution and DNS related
  • Detailed explanation of how to configure multiple domain names in Nginx on Alibaba Cloud Linux system
  • Implementation of virtual domain name under Linux (1)
  • Implementation of virtual domain name under Linux (2)
  • Implementation of virtual domain name under Linux (3)
  • Springboot+nginx+https+linux to achieve load balancing and domain name access simple test
  • How to configure virtual host under linux apache
  • Sharing of Apache server configuration and management methods under CentOS (Linux)
  • Detailed notes on installation and configuration of Apache, MySQL, and PHP under Linux
  • PHP+MYSQL+APACHE configuration process under Linux (excerpt)

<<:  Detailed explanation of the reasons and optimizations for the large offset affecting performance during MySQL query

>>:  How to use axios request in Vue project

Recommend

js handles account logout when closing the browser

Table of contents Classic approach question Furth...

The whole process of installing and configuring Harbor1.7 on CentOS7.5

1. Download the required packages wget -P /usr/lo...

Implementation steps for docker-compose to deploy etcd cluster

Table of contents Write docker-compose.yml Run do...

Management of xinetd-based services installed with RPM packages in Linux

Table of contents Preface 1. Startup management b...

Linux method example to view all information of the process

There is a task process on the server. When we us...

Detailed explanation of MySQL startup options and system variables examples

Table of contents Boot Options Command Line Long ...

Sample code for implementing 3D book effect with CSS

Without further ado, let's take a look at the...

How to quickly log in to MySQL database without password under Shell

background When we want to log in to the MySQL da...

Teach you step by step to configure MySQL remote access

Preface When using the MySQL database, sometimes ...

CSS sample code to achieve circular gradient progress bar effect

Implementation ideas The outermost is a big circl...

Summary of some HTML code writing style suggestions

Omit the protocol of the resource file It is reco...

The latest virtual machine VMware 14 installation tutorial

First, I will give you the VMware 14 activation c...

How to use html table (to show the visual effect of web page)

We know that when using HTML on NetEase Blog, we ...