
내 설정:
ubuntu 22.04
Apache/2.4.52 (Ubuntu) Server
I created /etc/apache2/sites-available/test.mysite.conf:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName test.xxxxxxxx.com
DocumentRoot /home/test/deploy/current
<Directory /home/test/deploy/current>
AllowOverride all
Options -MultiViews
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/test/error.log
CustomLog ${APACHE_LOG_DIR}/test/access.log combined
</VirtualHost>
다음과 같이 내장된 000-default.conf를 비활성화했습니다.
sudo a2dissite 000-default.conf
그리고 더 이상 /etc/apache2/sites-enabled에 없는지 확인했습니다.
그리고 가상 호스트를 활성화했습니다.
sudo a2ensite test.mysite.conf
그리고 그것이 이제 /etc/apache2/sites-enabled에 있는지 확인했습니다.
구성이 올바른지 확인했습니다.
sudo apache2ctl configtest
그리고 아파치 서버를 다시 시작했습니다.
sudo systemctl restart apache2
권한 목록은 다음과 같습니다.
drwxr-xr-x root root /
drwxr-xr-x root root home
drwxr-x--- test test test
drwxr-xr-x test test deploy
drwxrwxr-x test test current
-rw-rw-r-- test test index.html
이는 AWS에서 호스팅되므로 AWS에도 가서 보안 그룹의 인바운드 규칙을 확인하여 내 집 IP 주소(고정 IP 주소가 있음)에서 연결을 허용하는지 확인했습니다. 또한 서버에서 방화벽을 활성화하지 않았습니다.
하지만 내가 할 때http://test.xxxxxxxx.com
내 브라우저에 다음 메시지가 표시됩니다.
Forbidden
You don't have permission to access this resource.
Apache/2.4.52 (Ubuntu) Server at test.xxxxxxxx.com Port 80
어떤 아이디어가 있나요?
답변1
의 권한이 /home/test/
너무 제한되어 있습니다.
drwxr-x--- test test test
이 디렉토리 외에는 누구도 test
이 디렉토리에 들어갈 수 없으므로 Apache는 이를 읽을 수 없습니다.
/home/
어쨌든 웹루트를 배치하기에 적합한 장소는 아닙니다. 대신 사용하세요 /var/www
.