하위 도메인을 올바르게 가리킴

하위 도메인을 올바르게 가리킴

apache2ctl -S앞으로a2ensite subdomain.example.com.conf

[Sat Feb 18 13:15:55.649294 2017] [alias:warn] [pid 4524] AH00671: The Alias directive in /etc/phpmyadmin/apache.conf at line 3 will     probably never match because it overlaps an earlier Alias.
VirtualHost configuration:
*:443                  examplevps.com (/etc/apache2/sites-enabled/default-ssl.conf:2)
*:80                   examplevps.com  (/etc/apache2/sites-enabled/wordpress.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
Mutex mpm-accept: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

apache2ctl -S뒤쪽에a2ensite subdomain.example.com.conf

[Sat Feb 18 13:39:42.263129 2017] [alias:warn] [pid 4917] AH00671: The Alias dir                                                                   ective in /etc/phpmyadmin/apache.conf at line 3 will probably never match becaus                                                                   e it overlaps an earlier Alias.
VirtualHost configuration:
*:443                  examplevps.com (/etc/apache2/sites-enabled/default-ssl                                                                   .conf:2)
*:80                   is a NameVirtualHost
         default server subdomain.example.com (/etc/apache2/sites-enabled/subdomain.example.com.conf:1)
         port 80 namevhost subdomain.example.com (/etc/apache2/sites-enabled/                                                                   subdomain.example.com.conf:1)
                 alias subdomain.example.com
         port 80 namevhost examplevps.com (/etc/apache2/sites-enabled/wordpress.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
Mutex mpm-accept: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

하위 도메인이 내 vps의 디렉토리를 가리키도록 하고 싶습니다 Apache/2.4.10 (Debian). 하위 도메인을 만들고 서버의 A 레코드와 IP를 추가했습니다. 이제 브라우저에서 열면 하위 도메인이 기본 도메인을 가리킵니다.

기본 도메인은 에 있어야 합니다 /var/www/wordpress. 하위 도메인은 에 있어야 합니다 /var/www/subdomain.example.com.

그래서 /etc/apache2/sites-available내가 만들 때subdomain.example.com.conf

<VirtualHost *:80>

    ServerName subdomain.example.com
    ServerAlias subdomain.example.com

    # DocumentRoot 
    DocumentRoot "/var/www/subdomain.example.com"

    <Directory "/var/www/subdomain.example.com">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
    </Directory>

    # Logging
    ErrorLog "${APACHE_LOG_DIR}/error.log"
    CustomLog "${APACHE_LOG_DIR}/access.log" combined

</VirtualHost>

그럼 난 a2ensite subdomain.example.com.conf해냈어 service apache2 reload. 그 후에는 기본 도메인과 하위 도메인이 모두 반환됩니다 HTTP ERROR 500. 나는 길을 잃었다.

관련 정보