본문 바로가기
컴퓨터 활용/노년에 즐기는 코딩

탄력적 아이피 사용 후에 변경 사항

by easyfly 2025. 6. 27.
반응형

Django 프로젝트는 /home/ubuntu/madang 경로에 있고, Apache 설정 파일로는 /etc/apache2/sites-available/simadang.conf 를 사용하고 있습니다.


✅ 다음 확인 및 조치 순서

Apache가 Django 앱을 정상 서비스하지 못하는 이유를 찾기 위해, 아래 항목을 차례로 점검합니다.


🔍 1. simadang.conf 설정 확인

터미널에서 다음 명령으로 설정 파일을 엽니다:

sudo vi /etc/apache2/sites-available/simadang.conf

다음 항목이 있는지 확인해 주세요:

<VirtualHost *:80>
    ServerName [탄력적 아이피로 새로 변경된 아이피]

    Alias /static /home/ubuntu/madang/static
    <Directory /home/ubuntu/madang/static>
        Require all granted
    </Directory>

    <Directory /home/ubuntu/madang/simadang>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>

    WSGIDaemonProcess simadang python-path=/home/ubuntu/madang python-home=/home/ubuntu/madang/venv
    WSGIProcessGroup simadang
    WSGIScriptAlias / /home/ubuntu/madang/simadang/wsgi.py

    ErrorLog ${APACHE_LOG_DIR}/simadang_error.log
    CustomLog ${APACHE_LOG_DIR}/simadang_access.log combined
</VirtualHost>

python-path, python-home, wsgi.py 경로는 모두 현재 경로 구조에 맞게 되어 있어야 합니다.


🔍 2. simadang.conf 설정이 활성화되어 있는가?

sudo a2ensite simadang.conf

이미 활성화되어 있으면 "already enabled" 메시지가 출력됩니다.

그리고 기본 설정이 방해되지 않도록 000-default.conf 비활성화:

sudo a2dissite 000-default.conf


🔁 3. Apache 재시작

설정 반영을 위해 반드시 아래 명령 실행:

sudo systemctl restart apache2

🌐 4. 웹 접속 확인

브라우저에서 다음 주소 확인:

http://[새로 변경된 아이피]

더 이상 "Apache2 Default Page"가 보이지 않고, Django의 기본 페이지 또는 직접 만든 index 페이지가 보여야 합니다.


📌 요약 체크리스트

항목 상태 확인 방법
simadang.conf 내 VirtualHost 설정 *, 0.0.0.0, 또는 새 IP로 설정
WSGIDaemonProcess, WSGIScriptAlias 경로 실제 Python 가상환경과 wsgi.py 경로 일치 여부 확인
Apache 설정 활성화 a2ensite simadang.conf
기본 설정 제거 a2dissite 000-default.conf
Apache 재시작 sudo systemctl restart apache2

 

반응형

댓글