search
Homephp教程php手册Configure Apache multiple domain name servers under Ubuntu

 1. Goal:

 Achieve access to different domain names and different directories on this machine. That is: visit a.com to enter the program in the /var/www/a directory, visit b.com to enter the program in the /var/www/b directory.

 2. Problems encountered:

 /etc/apache2 folder directory

mods-available available modules conf-available available configurations sites-available available domain names/virtual directories ports.conf interface files

mods-enabled enabled module conf-enabled enabled configuration sites-enable enabled domain name/virtual directory envvars apache2.conf main configuration

Compared with the configuration file in Windos, Apache's configuration file in Ubuntu is relatively scattered. This is for low coupling. An error when configuring one of the sites will not affect the operation of other sites.

 apache2.conf This is the main configuration file. This file is like the framework of a building, which brings together the configuration files in the external scattered enable directory.

Now that the truth is clear, create a.conf b.conf in sites-available and create a soft link in sites-enable

But accessing all domain names will point to the www root directory. There is no problem when sites-enable has only one configuration file.


 3. Solve the problem

I have been confused for several days to no avail. Finally found the answer in a post. I still don’t fully understand the specific principles, so I’ll record them for future reference.

Just comment out the following two lines in the default configuration file.

ErrorLog ${APACHE_LOG_DIR}/error.log changed to

#ErrorLog ${APACHE_LOG_DIR}/error.log

CustomLog ${APACHE_LOG_DIR}/access.log combined changed to

#CustomLog ${APACHE_LOG_DIR}/access.log combined

Reference:

http://forum.ubuntu.org.cn/viewtopic.php?t=341070

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function