Apache 2.4.25(Debian) 서버 포트 80: localhost의 하위 도메인이 제대로 작동하지 않습니다.
로컬 호스트예피복재.
로컬호스트/사이트1예또한 일하고 있습니다.
site1.localhost는아니요피복재
변경됨문서 루트에서부터/var/www/html
/home/me/public_html
public_html 디렉토리에 site1, site2라는 두 개의 디렉토리를 만들었습니다.
public_html 디렉토리에는 다음 권한이 있습니다.
rwxr-xr-x 2 me me
구성:
/etc/hosts
127.0.0.1 localhost
127.0.1.1 debian
127.0.0.1 site1.localhost
/etc/apache2/sites-enabled/000-default.conf
<Directory /home/me/public_html>
Options Indexes FollowSymLinks
AllowOverride none
Order deny,allow
Allow from all
Require all granted
</Directory>
/etc/apache2/sites-available/site1.conf
<VirtualHost *:80>
ServerName site1.localhost
DocumentRoot /home/me/public_html/site1
</VirtualHost>
ste1.localhost는 다음을 반환합니다.
403 금지됨: Apache 2.4.25(Debian) 서버 위치:site1.localhost포트 80
$ sudo apache2ctl -S
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:80 is a NameVirtualHost
default server 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost site1.localhost (/etc/apache2/sites-enabled/site1.conf:1)
port 80 namevhost site2.localhost (/etc/apache2/sites-enabled/site2.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 proxy: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="me" id=1000
Group: name="www-data" id=33
$ ls -l /etc/apache2/sites-available
total 20
-rw-r--r-- 1 root root 1583 Sep 24 23:54 000-default.conf
-rw-r--r-- 1 root root 6338 Apr 5 14:32 default-ssl.conf
-rw-r--r-- 1 root root 103 Sep 24 11:03 site1.conf
-rw-r--r-- 1 root root 117 Sep 23 19:31 site2.conf
$ ls -l /etc/apache2/sites-enabled/
total 0
lrwxrwxrwx 1 root root 35 Sep 5 12:13 000-default.conf -> ../sites-available/000-default.conf
lrwxrwxrwx 1 root root 29 Sep 23 19:49 site1.conf -> ../sites-available/site1.conf
lrwxrwxrwx 1 root root 29 Sep 23 19:49 site2.conf -> ../sites-available/site2.conf