LAN을 통해 LAMP에 액세스할 수 있지만 사이트에 액세스할 수 없습니다.

LAN을 통해 LAMP에 액세스할 수 있지만 사이트에 액세스할 수 없습니다.

다음을 입력하면 휴대폰의 웹 브라우저를 사용하여 LAN을 통해 Ubuntu 20.04에서 실행되는 LAMP 서버의 디렉터리를 볼 수 있습니다.http://192.168.X.XXX. 그러나 사이트/디렉토리를 클릭하면 해당 사이트/디렉토리에 액세스할 수 없습니다.

LAMP에 자체 서명된 OpenSSL 인증서가 있지만 000-default.conf 아파치 구성도 있기 때문에 이는 예상된 동작입니다.

http를 입력하면에스://192.168.X.XXX에 대한 액세스가 올바르게 거부되었습니다.

내 질문은 다음과 같습니다
LAN을 통해 테스트할 수 있도록 로컬 LAMP 서버 URL을 만들려면 어떻게 해야 합니까?

예를 들어, 방문하고 싶습니다.

https://localhost.devsite.com내 휴대폰에는 nextcloud 서버도 설치되어 있습니다.

간단히 말해서 내 전화기는 LAN에 있는 LAMP 서버를 "볼" 수 있지만 LAMP 서버에 있는 실제 웹사이트는 볼 수 없습니다.

어떻게 되어가나요?

내 WordPress 설치에는 다음이 포함됩니다.

<VirtualHost *:443>

    ServerName localhost.someothersite.org
    ServerAlias www.localhost.someothersite.org
    
    # If this is the default configuration file we can use: 'ServerName localhost' or also 'ServerAlias localhost'.

    ServerAdmin [email protected]

    ErrorLog ${APACHE_LOG_DIR}/localhost.someothersite.org.error.log
    CustomLog ${APACHE_LOG_DIR}/localhost.someothersite.org.access.log combined

    DocumentRoot /var/www/html/someothersite.org
    
    <Directory /var/www/html/someothersite.org>
        Options None FollowSymLinks
        # Enable .htaccess Overrides:
        AllowOverride All
        DirectoryIndex index.php
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>

    <Directory /var/www/html/someothersite.org/wp-content>
        Options FollowSymLinks
        Order allow,deny
        Allow from all
    </Directory>
            
    SSLEngine on
   SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
   SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key

</VirtualHost>

내 nextcloud 설치에는 다음이 포함됩니다.

<VirtualHost *:443>
  DocumentRoot /var/www/html/nextcloud/
  ServerName  nextcloudinstall.org

  <Directory /var/www/html/nextcloud/>
    Require all granted
    AllowOverride All
    Options FollowSymLinks MultiViews
    Satisfy Any

    <IfModule mod_dav.c>
      Dav off
    </IfModule>
  </Directory>
</VirtualHost>

내 호스트 파일에는 다음이 있습니다.

127.0.0.1   nextcloudinstall.org
127.0.0.1   localhost.someothersite.org

답변1

웹 사이트는 DNS에서 올바르게 확인되고 가상 호스트로 설정된 경우에만 이름으로 액세스할 수 있습니다. IP로 사이트 중 하나만 보려면 아래에 정의된 기본 폴더가 표시됩니다./etc/httpd/conf/httpd.conf

DocumentRoot "/var/www/html"

이 방향. 액세스가 거부된 경우 폴더 사용자 권한을 확인하고 Apache 사용자 및 그룹이 이 폴더에 액세스할 수 있는지, 폴더가 존재하는지 확인하십시오. 그렇지 않으면 Apache는 이 폴더가 아닌 일반 환영 메시지만 표시합니다.

따라서 웹사이트 이름을 사용하려면 IP를 가리키도록 DNS 서버를 설정하고 localhost.devsite.com클라이언트(예: 휴대폰 또는 기타 컴퓨터)에서 해당 도메인 이름을 검색할 때 동일한 DNS를 사용해야 합니다.

관련 정보