Apache2.4 Configure

最後更新: 2023-05-18

目錄

  • ServerAlias
  • IncludeOptional & Include
  •  

ServerAlias

 

# Processed in the order they appear in the configuration.
# The first matching ServerName or ServerAlias is used.

# Format 1: Multiple
ServerAlias server server.example.com

# Format 2: Wildcard
ServerAlias *.example.com

# Format 3
ServerAlias server*.example.com

 


IncludeOptional & Include

 

# 當 Folder 內沒有 conf file 就會 start 唔起

Include conf.modules.d/*.conf

IncludeOptional vhosts/*.conf

 

應用: My vhosts Config

# Centos

conf.d/vhosts.conf

<VirtualHost *:80>
  ServerName -
  DocumentRoot /var/www/html
  ErrorLog /dev/null
  CustomLog /dev/null combined
  <Directory /var/www/html>
      AllowOverride None
      Options +Includes -FollowSymLinks
  </Directory>
  IndexOptions FancyIndexing
</VirtualHost>

IncludeOptional vhosts/*.conf

 


Config variables

 

Define RootDir /var/www

${RootDir}

 


Line Breaks in Apache httpd Configuration Directives

 

Just use the backslash "\"

i.e.

# Enable ECDSA-AES, RSA-AES, CHACHA20-POLY1305

SSLCipherSuite \
ECDHE-ECDSA-AES128-GCM-SHA256:\
ECDHE-RSA-AES128-GCM-SHA256:\
ECDHE-ECDSA-AES256-GCM-SHA384:\
ECDHE-RSA-AES256-GCM-SHA384:\
ECDHE-ECDSA-CHACHA20-POLY1305:\
ECDHE-RSA-CHACHA20-POLY1305