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

Understanding and usage scenarios of ES6 extension operators

Table of contents 1. Replace the apply method, ge...

Detailed explanation of the steps to create a web server with node.js

Preface It is very simple to create a server in n...

React+Antd implements an example of adding, deleting and modifying tables

Table of contents Table/index.js Table/model/inde...

Detailed explanation of the difference between var, let and const in JavaScript

Table of contents As a global variable Variable H...

MySQL 5.7.18 Installer installation download graphic tutorial

This article records the detailed installation tu...

MySQL integrity constraints definition and example tutorial

Table of contents Integrity constraints Definitio...

How to view and configure password expiration on Linux

With the right settings, you can force Linux user...

A brief discussion on the use of React.FC and React.Component

Table of contents 1. React.FC<> 2. class xx...

Detailed tutorial of using stimulsoft.reports.js with vue-cli

vue-cli uses stimulsoft.reports.js (nanny-level t...

Ubuntu 20.04 Best Configuration Guide (Newbie Essential)

1. System Configuration 1. Turn off sudo password...

50 Beautiful FLASH Website Design Examples

Flash enabled designers and developers to deliver...

HTML meta explained

Introduction The meta tag is an auxiliary tag in ...

Vue-cli creates a project and analyzes the project structure

Table of contents 1. Enter a directory and create...