이것이 바로 지금 제가 설정 한 것입니다.
cd / var / www mkdir -p test cd / var / www / test sudo nano index.html cd / etc / apache2 / sites-available sudo nano test.conf
<VirtualHost *:80>
ServerName localhost223.com
DocumentRoot /var/www/test
</VirtualHost>
$ sudo a2ensite test.conf $ sudo 서비스 apache2 reload
file:///var/www/test/index.html
웹 브라우저에서 다음과 같이 내 페이지에 액세스 할 수 있습니다 .
<html>
<h1>
here
</h1>
</html>
하지만 액세스 할 수 없습니다. http://localhost223.com
오류가 발생합니다. Could not resolve host
이 문제를 해결하는 방법은 무엇입니까?
@George가 말했듯이 서버의 IP를 가리키는 FQDN 은 없지만 파일 의 다음 줄을 통해 도메인 이름을 루프백 인터페이스 - 로 바인딩 해야 합니다.127.0.0.1
/etc/hosts
127.0.0.1 localhost223.com
그런 다음 다음과 같이 편집 /etc/apache2/sites-available/test.conf
하십시오.
<VirtualHost *:80>
ServerName localhost223.com
DocumentRoot /var/www/test
<Directory /var/www/test>
Options None FollowSymLinks
# Enable .htaccess Overrides:
AllowOverride All
DirectoryIndex index.html index.php
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
를 잊지 말고 sudo a2ensite test.conf
웹 서버를 다시 시작하십시오.
Ubuntu 14.04 : sudo service apache2 restart
Ubuntu 16.04 : sudo systemctl restart apache2.service
브라우저를 통해 페이지에 액세스 해보십시오.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다